实验others
来源:互联网 发布:网络接口教程 编辑:程序博客网 时间:2024/05/21 18:45
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
pid_t pid;
char *message;
int n;
printf("fork program starting");
pid=fork();
switch(pid)
{
case -1:
perror("fork failed");
exit(1);
case 0:
message="This is the child";
n=5;
break;
default:
message="This is the parent";
n=3;
break;
}
for(;n>0;n--)
{
puts(message);
sleep(1);
}
exit(0);
}
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
int main()
{
pid_t pid;
char *message;
int n;
printf("fork program starting");
pid=fork();
switch(pid)
{
case -1:
perror("fork failed");
exit(1);
case 0:
message="This is the child";
n=5;
break;
default:
message="This is the parent";
n=3;
break;
}
for(;n>0;n--)
{
puts(message);
sleep(1);
}
exit(0);
}
0 0
- 实验others
- others
- others
- Others
- others
- Others
- music&others
- Developing Others
- proc && others
- js -- others
- leetcode others...
- android -- others
- Some others
- fastboot & others
- 工具others
- (others)RIP
- (others)BGP4
- (OTHERS)BGP6
- 基金基础知识
- 参考文献中的字母含义
- UITableView样式的自定义
- 10+年程序员总结的20+条经验教训
- 对js中的引用类型的理解(6)——基本包装类型(Booelean、Number、String)
- 实验others
- IE浏览器无法加载外部CSS文件
- 数组排序
- bat语法
- Spring整合mybatis完整项目
- 时间选择器DatePickerDialog的简单demo
- Try to initialize ImageLoader which had already been initialized before. To re-init ImageLoader with
- canvas绘制bitmap1--两个bitmap交集裁剪等效果
- Python——while和for循环