The exit() and set_terminate() functions program example
Compiler: Visual C++ Express Edition 2005
Compiled on Platform: Windows XP Pro SP2
Header file: Standard
Additional project setting: Set project to be compiled as C++
Project -> your_project_name Properties -> Configuration Properties -> C/C++ -> Advanced -> Compiled As: Compiled as C++ Code (/TP)
To do: How to exit and terminate in C++ program
To show: The exit() and set_terminate() usage in C++ program
using namespace std;
cout<<"Funct() was called by terminate()."<<endl;
// 0-normal exit, non zero-exit with some error
// No catch handler for this exception
throw "Out of memory!";
cout<<"Integer exception raised."<<endl;
Funct() was called by terminate().
Press any key to continue . . .