Type iostate

An enumeration that is used to define the various states of a stream.

Table 1. Enumeration iostate
Flags Usage
goodbit True when all of badbit, eofbit and failbit are false.
badbit True when the stream is in an irrecoverable error state (such as failure due to lack of memory)
failbit True when a read or write has failed for any reason (This can happen for example when the input reads a character while attempting to read an integer.)
eofbit True when the end of the stream has been detected. Note that eofbit can be set during a read, and yet the read may still succeed (failbit not set). (This can happen for example when an integer is the last character in a file.)

Note: see variance from AT&T standard.

For an example of ios iostate flags usage refer to basic_ios::setstate() and basic_ios::rdstate()