bool stream::fail();

The fail() function returns true if an error has occurred with the current stream, false otherwise. This can be used for checking whether the previous operation has failed.

Examples of failures that cause fail to be set:

Once set, the fail state will make all other operations on the stream fail instantly, until the error state is cleared with the clear function.

Related Topics: bad, clear, eof, exceptions, good, rdstate

Stream states: