C++ std::fstream state flags cheat sheet
Out stream - no file is open:
is_open()=0 good()=1 eof()=0 fail()=0 bad()=0
Out stream - file open but not read/written:
is_open()=1 good()=1 eof()=0 fail()=0 bad()=0
Out stream - file opened and then closed:
is_open()=0 good()=1 eof()=0 fail()=0 bad()=0
Out stream - invalid filename:
is_open()=0 good()=0 eof()=0 fail()=1 bad()=0
In/Out stream - file open but not read/written:
is_open()=1 good()=1 eof()=0 fail()=0 bad()=0
In/Out stream - trying to read a char (eof):
[Read More]