C++/Console/cout terminator
Defines your own terminate( ) handler.
<source lang="cpp">
- 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;
}
</source>