Type for stream state flags
Bitmask type to represent stream error state flags.
This type is used as its parameter and/or return value by the member functions of the ios class.
All stream objects keep internally information on the state of the object that can be retrieved as an element of this type by calling member function ios::rdstate or set by calling 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 refered 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::good | Check if the state of the stream is good for i/o operations. (public member function) |
ios::bad | Check if badbit is set (public member function) |
ios::fail | Check if either failbit or badbit is set (public member function) |
ios::eof | Check if eofbit is set (public member function) |
|