octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #47537] textscan reads entire file even when g


From: Mike Miller
Subject: [Octave-bug-tracker] [bug #47537] textscan reads entire file even when given a count
Date: Fri, 25 Mar 2016 23:22:43 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0

URL:
  <http://savannah.gnu.org/bugs/?47537>

                 Summary: textscan reads entire file even when given a count
                 Project: GNU Octave
            Submitted by: mtmiller
            Submitted on: Fri 25 Mar 2016 04:22:42 PM PDT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: Need Info
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

When told to read a certain number of elements matching the format specifier
and its input is a file descriptor, textscan is supposed to stop reading the
input file at the last character that matched a conversion. Instead, the new
textscan reads the entire file up to EOF.

Example:


>> str = "1 2 3 4 5 6";
>> [t, pos] = textscan (str, "%d", 1)
t = 
{
  [1,1] = 1
}
pos =  2
>> fid = tmpfile;
>> fprintf (fid, str);
>> frewind (fid);
>> [t, pos] = textscan (fid, "%d", 1);
>> ftell (fid)
ans =  11
>> fclose (fid);
>> t, pos
t = 
{
  [1,1] = 1
}
pos = -1


I think in this case the results for both pos and ftell should be 2.

It would be helpful if someone could confirm these in Matlab.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47537>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]