public member type
<ios> <iostream>
Type for stream state flags
Bitmask type to represent stream error state flags.
All stream objects keep information on the state of the object internally. This information can be retrieved as an element of this type by calling member function basic_ios::rdstate or set by calling basic_ios::setstate.
The values passed and retrieved by these functions can be any valid combination (using the boolean OR
operator, "|
") of the following member constants:
flag value | indicates |
eofbit | End-Of-File reached while performing an extracting operation on an input stream. |
failbit | The last input operation failed because of an error related to the internal logic of the operation itself. |
badbit | Error due to the failure of an input/output operation on the stream buffer. |
goodbit | No error. Represents the absence of all the above (the value zero). |
These constants are defined in the ios_base class as public members. Therefore, they can be referred to either directly by their name as ios_base members (like ios_base::badbit) or by using any of their inherited classes or instantiated objects, like for example ios::eofbit
or cin.goodbit
.
See also
- ios::rdstate
- Get error state flags (public member function)
- ios::setstate
- Set error state flag (public member function)
- ios::good
- Check whether state of stream is good (public member function)
- ios::bad
- Check whether badbit is set (public member function)
- ios::fail
- Check whether either failbit or badbit is set (public member function)
- ios::eof
- Check whether eofbit is set (public member function)