Hi,
the RTS sometimes fails to report EOLn before EOF, when a new-line character is missing in the file. For example, this simple program
-------------------- program BufferedInput (Output, F);
var F: Text; Buffer: String (100);
begin Reset (F); while not EOF (F) do begin while not EOLn (F) do begin Read (F, Buffer); WriteLn ('read: `', Buffer, '''') end; WriteLn ('(end of line)'); ReadLn (F) end; WriteLn ('(end of file)') end. -------------------------
produces
---------------------- Input file `F': test read: `first line' (end of line) read: `second line, with no terminator' ./a.out: attempt to read past end of file `test' (error #454 at 8049c73) ----------------------
on this input (where line 2 doesn't end with <LF>):
--------------------- first line second line, with no terminator ---------------------
Emil Jerabek
Emil Jerabek wrote:
the RTS sometimes fails to report EOLn before EOF, when a new-line character is missing in the file. For example, this simple program [...]
The following should fix it (please check). (emil20.pas)
Frank
Frank Heckenbach wrote:
Emil Jerabek wrote:
the RTS sometimes fails to report EOLn before EOF, when a new-line character is missing in the file. For example, this simple program [...]
The following should fix it (please check). (emil20.pas)
Thanks, I'll try it.
Emil Jerabek
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html
Frank Heckenbach wrote:
Emil Jerabek wrote:
the RTS sometimes fails to report EOLn before EOF, when a new-line character is missing in the file. For example, this simple program [...]
The following should fix it (please check). (emil20.pas)
Great, it works :-)
Emil
Frank
-- Frank Heckenbach, frank@g-n-u.de, http://fjf.gnu.de/, 7977168E GPC To-Do list, latest features, fixed bugs: http://www.gnu-pascal.de/todo.html