1 #include <stdio.h>
2 #include <signal.h>
3 #include <Windows.h>
4
5 void callerror()
6 {
7 MessageBoxA(
0,
"error",
"error",
0);
8 }
9
10 void main()
11 {
12 if (signal(SIGINT, callerror) ==
SIG_ERR)
13 {
14 printf(
"信号创建失败");
15 }
16 else
17 {
18 //raise触发全局错误
19 raise(SIGINT);
20 }
21 }
转载于:https://www.cnblogs.com/xiaochi/p/8525345.html