-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathatexit.c
More file actions
30 lines (28 loc) · 699 Bytes
/
atexit.c
File metadata and controls
30 lines (28 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*************************************************************************
> File Name: atexit.c
> Author: jianghechao
> Mail: 591378033@qq.com
> Created Time: Tue 22 Apr 2014 01:05:49 AM CST
************************************************************************/
#include"apue.h"
static void my_exit1();
static void my_exit2();
int main()
{
if(atexit(my_exit2)!=0)
perror("can't register my_exit2");
if(atexit(my_exit1)!=0)
perror("can't register my_exit1");
if(atexit(my_exit1)!=0)
perror("can't register my_exit1");
printf("main is done\n");
return 0;
}
static void my_exit1()
{
printf("first exit handler\n");
}
static void my_exit2()
{
printf("second exit handler\n");
}