badbit
In the C++ standard library, badbit is a flag representing an irrecoverable error on a stream. It is part of the iostreams state set defined by std::ios_base::iostate and is used alongside eofbit and failbit to describe a stream's condition. The presence of badbit indicates that the stream has become unusable for further I/O operations, usually due to a hardware or serious library-level problem.
Badbit differs from eofbit (end-of-file) and failbit (a logical error in a stream operation) in that it
Detection and handling: You can query with stream.bad() to test for a badbit condition, or use rdstate()
Causes: Badbit is set by the underlying stream buffer when an irrecoverable error occurs on the input
Notes: Badbit is defined by the C++ standard library's ios_base::badbit and is one of the four iostate