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

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

[Octave-bug-tracker] [bug #58055] ftell() incorrect on MS Windows platfo


From: John W. Eaton
Subject: [Octave-bug-tracker] [bug #58055] ftell() incorrect on MS Windows platforms if file is not encoded with CRLF line endings
Date: Thu, 9 Apr 2020 15:26:44 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0

Follow-up Comment #13, bug #58055 (project octave):

OK, looking again, I see that if you are just using fseek with SEEK_SET to
return to a position returned by ftell, it should work, even in text mode.

If you do something like


fid = fopen ("some_file", "rt");
k = 0;
while (k++ < 100)
  c = fread (fid, 1);
  if (c < 0) break; endif
  printf ("%d: %d\n", ftell (fid), c);
endwhile


on a Windows system when "some_file" uses LF line-endings, does the file
position returned by ftell jump by 2 when the LF character (ASCII 10) is
read?

Or is the incorrect count just a problem when using fgetl/fgets to read the
file?


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?58055>

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

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