[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines
From: |
Rik |
Subject: |
[Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines |
Date: |
Wed, 26 Aug 2015 17:42:35 +0000 |
User-agent: |
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:35.0) Gecko/20100101 Firefox/35.0 |
Follow-up Comment #4, bug #45808 (project octave):
I went back to first principles and assume that fscanf should behave as the
low-level C function.
I've attached a simple example, fscanf.c, and an accompanying data file,
fscanf.txt. Use 'gcc fscanf.c' to compile and then run a.out.
The newline character is counted as whitespace and eats as much as possible.
In the example file I have a line following the first that is just made of of
spaces, a tab, and a completing newline. All of it gets eaten by fscanf. So
the Matlab result is correct.
At least at the C level, I checked and it seems that a partially failing
template still eats whitespace following the last successfuly read parameter.
status1 = fscanf (fid, "; %d%d", &num, &num);
reads line 1 and line 2 of fscanf.txt
(file #34740, file #34741)
_______________________________________________________
Additional Item Attachment:
File name: fscanf.c Size:0 KB
File name: fscanf.txt Size:0 KB
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?45808>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, anonymous, 2015/08/21
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Rik, 2015/08/25
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Jordi Burguet Castell, 2015/08/26
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, John W. Eaton, 2015/08/26
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines,
Rik <=
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, John W. Eaton, 2015/08/26
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, John W. Eaton, 2015/08/26
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Rik, 2015/08/26
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Rik, 2015/08/26
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, John W. Eaton, 2015/08/27
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Rik, 2015/08/27
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Jordi Burguet Castell, 2015/08/27
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Rik, 2015/08/27
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, Jordi Burguet Castell, 2015/08/27
- [Octave-bug-tracker] [bug #45808] fscanf odd behavior with newlines, John W. Eaton, 2015/08/28