I set the exception mask failbit
of an ifstream by doing:
#include <iostream> #include <fstream> int main() { try { std::ifstream in("in.txt"); in.exceptions(std::ifstream::failbit); } catch (std::ios_base::failure &fail) { // handle exception here } }
Is there any way I can clear or restore the exception mask?