Mega Code Archive

 
Categories / C++ / Console
 

Defines your own terminate( ) handler

#include <iostream> #include <cstdlib> #include <exception> using namespace std; void myTerminator() {   cout << "Your own terminate handler\n";   abort(); } int main() {      set_terminate(myTerminator);      try {     cout << "Inside try block.";     throw 100;    }   catch (double i) {    }   return 0; }