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: Toby
Subject: [Octave-bug-tracker] [bug #58055] fgetl() reads in beyond newline according to following ftell()
Date: Tue, 31 Mar 2020 02:21:56 -0400 (EDT)
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0

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

Sorry for not being precise enough in my prior comment. A file encoded with
CRLF works as expected (like LF on a Linux system). fpos() + fseek() get the
file pointer back exactyl to where you've been before.

Here's the output of the modified script ofr the file encoded with LF line
breaks:
----

>> tst_58055

### First 4 lines of file ###
ans = 1234 line1
ans = 12345 line2
ans = 123456line3
ans = 1234567 line4
### Current file position ###
fpos =  29
### 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 =  29
### Line 5 second time ###
second_pass = 56line3
### Line 6 (should be) ###
ans = 1234567 line4
>>

And for reference (confirmation):
fpos =  56 when operating on the file encoded with CRLF.

    _______________________________________________________

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]