Head command program trouble

Hello Everyone,
Figured it out. Thanks


 
 


Thanks
Last edited on
Closing a file stream does not reset error flags. Opening new file resets them in C++11, but not in earlier versions, so if at any time error happened, fin.fail() will return true even after opening new file. Call .clear() manually after closing file. Additionally it is better to use is_open() member funtion to chec if file was open.
See this post regarding this exact question, I'm guessing one of your classmates got here earlier than you did -> http://www.cplusplus.com/forum/beginner/154451/
Topic archived. No new replies allowed.