Thread: test score
View Single Post
Old Sep 27th, 2006, 5:40 AM   #6
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
Sure, EOF is the issue. Your last read grabs the last line and newline. That is not EOF, since you haven't attempted to read beyond it. The "while (fin)" looks fine, so you attempt to read again and hit EOF. You aren't checking for that. This is one of most common novice mistakes.
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote