Windows atexit函数
程序意外崩溃或者自然关闭,执行制定函数
#include <cstdlib>
#include <iostream>
using namespace std;
void customized_exit()
{
printf("exit main to execute\n");
}
int main(int argc, char** argv)
{
atexit(customized_exit);
printf("enter anything to end program\n");
//getchar();
int a[4];
a[8] = 0;
float _test = -120.369;
unsigned int x = -2;
float ptm = x;
int dm = x;
bool rt = x > 0;
bool rt2 = x < 1200;
printf("unsigned int: %f %d %d %d\n", ptm, rt, rt2, dm);
getchar();
return 0;
}

浙公网安备 33010602011771号