void myterminate ()
{
cout << "terminate handler called";
}
int main (void)
{
set_terminate (myterminate);
throw; // throwing an exception. So, terminate handler should be invoked
// as no one is handling this exception.
getch();
return 0;
}
But After executing this code, the output is:
terminate handler called + "Debug Error!" dialog box appears.
I am not sure why it is coming like this !!!! Please help.
Based on the MSDN documentation for set_terminate the new handler function must call
exit()orabort()will be called:For example: