void printstate(const std::ios &ios) { if (ios.good()) { std::cout << "ios.good" << std::endl; } else if (ios.eof()){ std::cout << "ios.eof" << std::endl; } else if (ios.fail()){ std::cout << "ios.fail" << std::endl; } else if (ios.bad()){ std::cout << "ios.bad" << std::endl; } }
void print_state (const std::ios& stream) { std::cout << " good()=" << stream.good(); std::cout << " eof()=" << stream.eof(); std::cout << " fail()=" << stream.fail(); std::cout << " bad()=" << stream.bad(); }
void show_results( std::ios& stm ) { std::cout << std::boolalpha << "bad: " << stm.bad() << " fail: " << stm.fail() << " eof: " << stm.eof() << " good: " << stm.good() << " bool(stm): " << bool(stm) << " !stm: " << !stm << '\n' ; }
//prints the error flags when an attempt to open a file fails void util::print_state (const std::ios& stream) { cerr << " good()=" << stream.good(); cerr << " eof()=" << stream.eof(); cerr << " fail()=" << stream.fail(); cerr << " bad()=" << stream.bad(); }