#Infinitely looping file input test?
13 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question use !howto ask.
you clear the EOF
atleast, I think inFS.clear() would clear the EOF flag
Don’t I have that at the very end of the loop?
At line 42
Oh you’re saying to NOT have .clear() because it’s clearing the EOF flag…
It did not fix anything by deleting it ://
I realized my logic was bad. It needs to read THEN check if it’s eof(),
I’d likely be better to instead use the return of the IO function itself coming from the ifstream then to use .eof() to detect if you’ve actually reached the end of the file.
At least in the loop here
But yes you are clearing the error state with .clear() which makes it so EOF is never visibly set to the loop.
Yep this is on the money