check if a state is okios
while(cin >> word)
// ok: read successfulcode
ios_base
as public members
ios_base::badbit
: corrupted.
ios_base::failbit
: failed.
ios_base::eofbit
: hit end-of-file.ios_base::goodbit
: not in an error state.
failbit
and badbit
is set when an error occured during an input operation.eofbit
and failbit
.fail()
is a synonym of ios::operator!
s.bad()
: eofbit
is set.s.fail()
: failbit
or badbit
is set.s.eof()
: eof
is set.s.good()
: none of above three states is set.s.is_open()
:s.clear()
: reset all condition values in the stream to valid state.basic_ios::rdstate
basic_ios::setstate
std::ios_base::iostate
is type for stream error state flagsReferences:three