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

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

[Octave-bug-tracker] [bug #58055] fgetl() reads in beyond newline accord


From: Rik
Subject: [Octave-bug-tracker] [bug #58055] fgetl() reads in beyond newline according to following ftell()
Date: Mon, 30 Mar 2020 11:01:14 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; Trident/7.0; rv:11.0) like Gecko

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

Only somewhat helpful, but I can confirm that on Linux the script behaves as
expected.  This is a Windows-specific issue.

I've uploaded a modified test script as tst_58055.m.  Could you run it on a
Windows platform and post the results?  In particular, it checks the status
output of the fseek call to make sure that nothing obviously went wrong
there.

The results for Linux are 


### First 4 lines of file ###
ans = 1234 line1 
ans = 12345 line2 
ans = 123456line3 
ans = 1234567 line4
### Current file position ###
fpos =  56
### Line 5 ###
first__pass = 12345678 line5 
### Count lines in file ###
linecount =  5
ans =  6
ans =  7
ans =  8
ans =  9
ans =  10
ans =  11
ans =  12
ans =  13
ans =  14
ans =  15
ans =  16
ans =  17
ans =  18
ans =  19
ans =  20
ans =  21
ans =  22
ans =  23
ans =  24
ans =  25
ans =  26
ans =  27
### Status of fseek call ###
status = 0
### File position after fseek call ###
fpos =  56
### Line 5 second time ###
second_pass = 12345678 line5 
### Line 6 (should be) ###
ans = 1234567 line6 


Also, I couldn't quite tell from your response whether it made a difference if
the text file was encoded with newlines which match the platform (LF for
Linux, CRLF for Windows).  I've uploaded a version of dummy.txt called
dummy.CRLF.txt which has Windows line endings.  Could you modify the script
to


fopen ("dummy.CRLF.txt") 


and re-run to see if that changes anything.


(file #48711, file #48712)
    _______________________________________________________

Additional Item Attachment:

File name: tst_58055.m                    Size:0 KB
    <https://savannah.gnu.org/file/tst_58055.m?file_id=48711>

File name: dummy.CRLF.txt                 Size:0 KB
    <https://savannah.gnu.org/file/dummy.CRLF.txt?file_id=48712>



    _______________________________________________________

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]