C++ IOS Library - ios_base iostate



Description

This is used forAll 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 as shown below −

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.

ios.htm
Advertisements