public member function
void setstate ( iostate state );

Set error state flag

Modifies the current error state value by combining (like with a bitwise OR operation) the error state flags passed as argument with those currently set for the stream.

Any error bitflag already set is not cleared. If you want to modify the state flags without keeping the current value, use clear() instead.

The effect of this function is the same as a call to:
clear ( rdstate() | state );


An object of type ios_base::iostate that can take as value any combination of the following member constants:

flag valueindicates
eofbitEnd-Of-File reached while performing an extracting operation on an input stream.
failbitThe last input operation failed because of an error related to the internal logic of the operation itself.
badbitError due to the failure of an input/output operation on the stream buffer.
goodbitNo error. Represents the absence of all the above (the value zero).

These values are declared as static member constants in the parent class ios_base. More than one state flag can be combined using the bitwise OR operator (|).

Return Value


Basic template member declaration

( basic_ios<charT,traits> )
void setstate ( iostate state );

See also