[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: getl strange behaviour (?)
From: |
talassio |
Subject: |
Re: getl strange behaviour (?) |
Date: |
Thu, 17 Jul 2008 08:32:31 -0700 (PDT) |
Hello ,
My Octave version is 3.0.0, and yes, the patch does fix the problem.
Thank you for pointing it out.
Jaroslav Hajek-2 wrote:
>
> On Thu, Jul 17, 2008 at 5:07 AM, talassio <address@hidden> wrote:
>>
>> Hello!
>>
>> Suppose we want to getl the following file: fid=fopen(pfmc100.dimacs,
>> "r");
>> --- start file ---
>> a 5 4 0 5 -1
>> a 6 5 0 8 0
>> a 6 4 0 15 7
>> --- end file ---
>>
>>> linea = getl(fid);
>>> [str de a l u c cnt] = sscanf(linea, '%s %i %i %i %i %i', "C");
>> c = -1
>> cnt = 6
>>
>>> linea = getl(fid);
>>> [str de a l u c cnt] = sscanf(linea, '%s %i %i %i %i %i', "C");
>> c = [](0x0)
>> cnt = 5
>>
>>> linea = getl(fid);
>>> [str de a l u c cnt] = sscanf(linea, '%s %i %i %i %i %i', "C");
>> c = 7
>> cnt = 6
>>
>> That is, if the last number on a line is 0 (zero) it won't be correctly
>> read: c=[](0x0) with cnt=5. If it is other number/letter there is no
>> problem
>> (cnt=6).
>>
>> A work around is:
>
> Next time please read http://www.gnu.org/software/octave/bugs.html
> for details about bug reporting.
>
> What's your Octave version?
> I guess you're seeing the problem reported and fixed here:
> http://www.nabble.com/sscanf-misses-%220%22-conversion-w--%22-i%22-at-end-of-string-td16637114.html#a16662072
>
> Anyway, it is apparent that it is a problem with sscanf and not fgetl.
>
> regards
>
>>
>>> [str de a l u c cnt] = sscanf(linea, '%s %i %i %i %i %s', "C");
>> c = str2num(c)
>>
>> and worked as expected on the lines where the last item is a 0 (zero).
>>
>> I am not sure this is the correct behaviour of getl(...).
>>
>> Any comments?
>>
>> Andres.
>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/getl-strange-behaviour-%28-%29-tp18500752p18500752.html
>> Sent from the Octave - General mailing list archive at Nabble.com.
>>
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>>
>
>
>
> --
> RNDr. Jaroslav Hajek
> computing expert
> Aeronautical Research and Test Institute (VZLU)
> Prague, Czech Republic
> url: www.highegg.matfyz.cz
> _______________________________________________
> Help-octave mailing list
> address@hidden
> https://www.cae.wisc.edu/mailman/listinfo/help-octave
>
>
--
View this message in context:
http://www.nabble.com/getl-strange-behaviour-%28-%29-tp18500752p18511270.html
Sent from the Octave - General mailing list archive at Nabble.com.