TL;DR
while(!feof) is wrong because it tests for something that is irrelevant and fails to test for something that you need to know. The result is that you are erroneously executing code that assumes that it is accessing data that was read successfully, when in fact this never happened.
I'd like ...
Also, as I recall, there was slight difference between Windows and Linux on this matter. I just don't remember what exactly :D
mhm. Weird. I'd suspect that on Windows, somehow, it reads the last number, but still detects EOF while reading in, and by Your logics it does not print the last number. Not so sure about that... Does putting extra space, new line, etc changes anything on Windows?
@Curio yeah, make sure there is a newline at the end of the file and see if you get better results. using *nix apps on windows myself, all my text files end with newlines. even github for windows shows an "warning" icon telling you the file doesn't end with a newline
@Curio also, keep in mind, windows newline is \r\n, nix is \n. Some document editors in windows will automatically convert \n to \r\n if you save over the original file, or will add \r\n if you enter a newline in windows editors. if you then feed that file back to nix system, it could cause oddities because nix is expecting \n but the file contains \r\n. This is why i turn on "View > Show Symbols > Show all characters" in notepad++ so I can see what original source is expecting