Newline consistency
Original Reporter info from Mantis: sinuhe
-
Reporter name: D. E. Evans
Original Reporter info from Mantis: sinuhe
- Reporter name: D. E. Evans
Description:
If the LineEnding constant shows CRLF (or LFCR), which is a string, not a single character, doesn't it make sense that line based functions, e.g. readln, should be consistent with it?
For instance, on Windows with CRLF recognized as the default for LineEnding, why does the following program read a Unix file that has no carriage return character, and report more than 0 lines were read?:
program linecount (input, output);
procedure linecount;
var nl : INTEGER;
begin
nl := 0;
while not eof do begin readln; nl := nl + 1; end;
write(nl:1); writeln
end;
begin linecount
end.
The only reason I can imagine is that it is only looking to the linefeed character, not the combination of carriage return, followed by linefeed. This seems to me to be a bug. What am I missing?