Hi, just did some testing of when EOF gets set when reading files:
If you run the above code and stick a single line of text in a text file (doesn't matter if you press Enter at the end of the line) then the code will report EOF (End of File). This is DIFFERENT from languages like Delphi where EOF only get's set after you try to read another line and the read fails.
This makes quite a bit of difference when coding your filereading loops because after you read the last value, EOF is already set, you don't need to read another line to set it. Be careful :-)
Strict Local file:TStream = ReadFile("test.txt") Local l$ = ReadLine(file) If Eof(file) Then Print "EOF!" CloseStream(file)
If you run the above code and stick a single line of text in a text file (doesn't matter if you press Enter at the end of the line) then the code will report EOF (End of File). This is DIFFERENT from languages like Delphi where EOF only get's set after you try to read another line and the read fails.
This makes quite a bit of difference when coding your filereading loops because after you read the last value, EOF is already set, you don't need to read another line to set it. Be careful :-)