C++ Tutorial/Development/set terminate — различия между версиями

Материал из C\C++ эксперт
Перейти к: навигация, поиск
м (1 версия: Импорт контента...)
 
(нет различий)

Текущая версия на 10:28, 25 мая 2010

Set a new terminate handler

#include <iostream>
#include <cstdlib>
#include <exception>
using namespace std;
void my_Thandler() {
  cout << "Inside new terminate handler\n";
  abort();
}
int main()
{
  set_terminate(my_Thandler);
  throw 100; // throw an error
  return 0;
}
Inside new terminate handler
This application has requested the Runtime to terminate it in an unusual way.
Please contact the application"s support team for more information.