padding in arguments string array for popen2 or exec

Jaroslav Hajek highegg at gmail.com
Mon Mar 2 05:56:27 CST 2009


On Mon, Mar 2, 2009 at 12:50 PM, Olaf Till <olaf.till at uni-jena.de> wrote:
> On Mon, Mar 02, 2009 at 12:27:05PM +0100, Jaroslav Hajek wrote:
>>> ...
>> Sorry I can't inspect octave 2.1.72 sources, but what you see is the
>> consequence of char padding by spaces when creating character
>> matrices. I don't think all_strings can just discard the any trailing
>> whitespaces. That would carry the potential hazard of discarding
>> something that was real data. I suggest you just use cell arrays
>> instead, which save you from this kind of trouble.
>>
>> regards
>
> Yes, I just noticed that using cell-arrays is possible.
>
> BTW I did not know whether whitespace is really introduced at
> creation-time of string-arrays. This would mean that trailing
> whitespace indeed had been discarded in 2.1.73.
>

When you use a a character matrix (a rectangular char array with a
string per row), you need padding because the matrix must be
rectangular.

> Anyway, using cell-arrays should be fine, but maybe string-arrays
> should not be accepted then any more by popen2 or exec, since they do
> not work, and the documentation changed.

The meaning of "string array" is vague. The unambigous terms are
"character matrix" and "cell array of strings". Both are slightly more
wordy, though.


> Olaf
> _______________________________________________
> Bug-octave mailing list
> Bug-octave at octave.org
> https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave
>



-- 
RNDr. Jaroslav Hajek
computing expert
Aeronautical Research and Test Institute (VZLU)
Prague, Czech Republic
url: www.highegg.matfyz.cz


More information about the Bug-octave mailing list