I want to:
1) use ifstream::get(char &) and ifstream::read()
2) set std::ios_base::badbit and std::ios_base::failbit in ifstream::exceptions()
Problem: eofbit is set together with failbit.
Why couldn't the EOF bit be set before trying to read beyond the EOF and failing?!
How can I deal with this, other than by using stream iterators (because I'd need to iterate short int as well, and that doesn't work).
Last edited on
One way is to turn off exceptions for failbit and check if eofbit is not set after the loop and in that case throw the exception yourself.