In what practical case bool(std::ifstream) != std::ifstream::good()?
问题 I would like to know in what case we can have : bool(std::ifstream) != std::ifstream::good() The difference is that bool(std::ifstream) does not test the eof bit whereas std::ifstream::good() tests it. But practically, the eof bit is raised if one try to read something after the end of the file. But as soon as you try to do this I think that either fail or bad bit is also set. Consequently in what case you can only raise the eof bit ? 回答1: Simply put, whenever you encounter the end of a file