Hi gurus,
I'm trying to understand how to properly handle exceptions thrown by the ios classes. "nosuchfile.txt" doesn't exist so I would expect to be thrown an exception indicating just that...
Except the output I get is:Code:#include <iostream> #include <fstream> using std::cout; using std::fstream; int main (int argc, char * const argv[]) { try { fstream ifs; ifs.exceptions(fstream::failbit); ifs.open("nosuchfile.txt", fstream::in); } catch (fstream::failure& ex) { std::cout << ex.what() << std::endl; } return 0; }
basic_ios::clear
Which doesn't seem very helpful. Could someone help me understand what's going on here?
Thanks!
-L




Reply With Quote