When I open a file in binary mode, does a situation exist where is_open() is true but good() is false ?
bool ok = false;
std::ifstream stream("test.dat", std::ios::binary)
if (stream.is_open())
{
ok = stream.good();//Does a situation exist where the result of this is false ?
stream.close();
}
No: the two-argument constructor of
std::ifstreamis required to set the failbit if file opening fails.and, for open(),