#include <iostream>iostate rdstate() const;
The rdstate( ) function is a member of ios.
The rdstate( ) function returns the status of the associated stream. The C++ I/O system maintains status information about the outcome of each I/O operation relative to each active stream. The current state of a stream is held in an object of type iostate, in which the following flags are defined:
Name |
Meaning |
---|---|
goodbit |
No errors occurred |
eofbit |
End of file is encountered |
failbit |
A nonfatal I/O error has occurred |
badbit |
A fatal I/O error has occurred |
These flags are enumerated inside ios (via ios_base).
rdstate( ) returns goodbit when no error has occurred; otherwise, an error bit has been set.
Related functions are eof( ), good( ), bad( ), clear( ), setstate( ), and fail( ).