29 Input/output library [input.output]

29.5 Iostreams base classes [iostreams.base]

29.5.5 Class template basic_­ios [ios]

29.5.5.4 Flags functions [iostate.flags]

explicit operator bool() const;
Returns: !fail().
bool operator!() const;
Returns: fail().
iostate rdstate() const;
Returns: The error state of the stream buffer.
void clear(iostate state = goodbit);
Effects: If ((state | (rdbuf() ? goodbit : badbit)) & exceptions()) == 0, returns.
Otherwise, the function throws an object of class ios_­base​::​failure ([ios.failure]), constructed with implementation-defined argument values.
Postconditions: If rdbuf() != 0 then state == rdstate(); otherwise rdstate() == (state | ios_­base​::​badbit).
void setstate(iostate state);
Effects: Calls clear(rdstate() | state) (which may throw ios_­base​::​failure ([ios.failure])).
bool good() const;
Returns: rdstate() == 0
bool eof() const;
Returns: true if eofbit is set in rdstate().
bool fail() const;
Returns: true if failbit or badbit is set in rdstate().296
bool bad() const;
Returns: true if badbit is set in rdstate().
iostate exceptions() const;
Returns: A mask that determines what elements set in rdstate() cause exceptions to be thrown.
void exceptions(iostate except);
Effects: Calls clear(rdstate()).
Postconditions: except == exceptions().
Checking badbit also for fail() is historical practice.
 â®¥