Defines your own terminate( ) handler. : cout terminator « Console « C++






Defines your own terminate( ) handler.

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;
}

           
       








Related examples in the same category