3.27
来源:互联网 发布:涉税软件下载 编辑:程序博客网 时间:2024/06/06 21:40
#include <stdio.h>
#include <signal.h>
#include <sys/types.h>
#include <stdlib.h>
void myfunc(int sign)
{
if(sign == SIGINT)
{
printf("hello world!\n");
}
if(sign == SIGQUIT)
{
printf("exit!\n");
exit(1);
}
}
int main()
{
pid_t pid;
int select;
pid = fork();
if(pid == 0)
{
signal(SIGINT,myfunc);
signal(SIGQUIT,myfunc);
pause();
}
if(pid > 0)
{
scanf("%d",&select);
if( select == 1)
{
kill(pid,SIGINT);
}
if(select == 2)
{
kill(pid,SIGQUIT);
}
}
}
#include <signal.h>
#include <sys/types.h>
#include <stdlib.h>
void myfunc(int sign)
{
if(sign == SIGINT)
{
printf("hello world!\n");
}
if(sign == SIGQUIT)
{
printf("exit!\n");
exit(1);
}
}
int main()
{
pid_t pid;
int select;
pid = fork();
if(pid == 0)
{
signal(SIGINT,myfunc);
signal(SIGQUIT,myfunc);
pause();
}
if(pid > 0)
{
scanf("%d",&select);
if( select == 1)
{
kill(pid,SIGINT);
}
if(select == 2)
{
kill(pid,SIGQUIT);
}
}
}
0 0
- 3.27
- 3.27
- 3.27
- 3.27
- 3.27
- 3.27
- 2010 3.27 晴
- 3.27日学习记录
- J2EE轻量级框架--3.27学习心得
- [杂七杂八-iOS]个人总结3.27
- 传智博客课堂学习笔记3.27
- Justin_第1组_2009.3.27
- leetcode JAVA Subsets 难度系数3 3.27
- win7 iis 配置PHP5.3.27实践记录
- Reading Paper for Pedestrian detection 3.22-3.27
- 晴(大风) 18℃ 3.27日
- C++ primer-练习3.27和3.28
- 3.27-如何在 主应用程序窗口 的背景上画图?
- 矩阵的的初步认识
- github创建可访问的静态网站,个人博客教程
- undefined reference to `__gxx_personality_v0'
- JavaScript学习之作用域(一)
- 401. Binary Watch
- 3.27
- bzoj2154 Crash的数字表格
- linux基础
- gulp安装步骤
- JVM加载类过程的总结
- C++模板实现二叉查找树(一 树的数据结构定义与节点插入)
- 217. Contains Duplicate
- Java多线程编程
- 蓝桥杯-第n个素数