Subj : EOF (end of file) problem To : borland.public.cpp.borlandcpp From : Karlo Basic Date : Sat Nov 01 2003 12:30 pm Hi! I hope I'm asking the right question in the right group. I have a problem with a piece of C++ code that runs well under Linux (gcc 2.96) but doesn't run as expected in Windows (Borland C++ 5.5.1): Here's the code: ********** int num; ifstream in_file; in_file.open("whatever.txt"); while (!in_file.eof()) cin >> num; ********** Example input: 1 2 3 4 5 6 7EOF -> Linux OK; Windows not 1 2 3 4 5 6 7 EOF -> Linux & Windows OK In Linux it reads right to the end of the file. But in Windows it misses the last number (7) unless there's a newline character at the end of the last line to be read. If I replace "int num" with "char num" the it works as it should. What am I missing here? Thanks in advance, Karlo. .