bad
Syntax:
#include <fstream> bool bad();
The bad() function returns true if a fatal error with the current stream has occurred, false otherwise.
Note: fatal errors do not normally occur. Even a failure to open a file is not a fatal error.
Related Topics: clear, eof, exceptions, fail, good, rdstate
Stream states:
- if (s): The previous operation was successful (a shorthand for !s.fail()).
- if (s.fail()): The previous operation failed.
- if (s.eof()): Reading past the end has been attempted.
- if (s.bad()): Stream state is undefined; the stream can no longer be used.
- if (s.good()): None of bad/eof/fail are set.