Why is failbit set when eof is found on read?
The failbit is designed to allow the stream to report that some operation failed to complete successfully. This includes errors such as failing to open the file, trying to read data that doesn’t exist, and trying to read data of the wrong type. The particular case you’re asking about is reprinted here: char buffer[10]; stream.read(buffer, … Read more