_onexit用法

来源:互联网 发布:linux 目录空间不足 编辑:程序博客网 时间:2024/05/18 07:34


#include "stdafx.h"
#include <iostream>
using namespace std;

int fun1()
{
 cout << "this is 1" << endl;
 return 0;
}
int fun2()
{
 cout << "this is 2" << endl;
 return 0;
}

int _tmain(int argc, _TCHAR* argv[])
{
 _onexit(fun1); //_onexit 使用方法:函数必须是 带有int类型返回值的无参数函数
 _onexit(fun2);
 return 0;
}


output:

this is 2
this is 1

0 0
原创粉丝点击