Thanks, again I understand that. To better understand what i'm talking about here's the full program code, and on one of the loops my pseudocode is telling me to code "is eof". the rest of the pseudo says not eof.
So, while(!fin.eof()) basically translates to is not eof.
would (fin.eof()) translate to IS eof?
fin.eof() does not check if the stream is at the end and does not predict the future; it only reports if a stream input operation ran past the end of file in the past. When you reach end of file, fin.eof() is false, fin.get(ch); runs past the end and so fails, leaving ch unmodified, and then cout << ch; prints that unmodified character from the last loop iteration (for a typical text file, the endline character), one more time. Only on the next iteration after that, fin.eof() is true.
The correct way to read a stream to end of file (or any other error) is