Reading from a file

Pages: 123
As far as I'm aware, files (on modern operating systems) don't need or have an EOF marker.


True. I was referring to file stream eof state.

the output from my program gave the correct number of lines (6 for that test file) when tested under Windows


It depends upon whether there is a final '\n' or not in the file.

If the file has:


have 21 words.<eof>


then no - it reports 5 lines.

If the file has:


have 21 words.'\n'<eof>


then yes it reports 6 lines as expected.
Topic archived. No new replies allowed.
Pages: 123