ios::fail
int fail() const;
Return Value
Returns a nonzero value if any I/O error (not end of file) has occurred. This condition corresponds to either the badbit or failbit error flag being set. If a call to bad returns 0, you can assume that the error condition is nonfatal and that you can probably continue processing after you clear the flags.
ios Overview | Abstract Stream Base Class
See Also ios::bad, ios::clear