1 Star 1 Fork 0

高泽正 / 信息安全系统与设计

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
fork.c 647 Bytes
一键复制 编辑 原始数据 按行查看 历史
高泽正 提交于 2021-10-24 13:43 . add fork.c.
#include <unistd.h>
#include <stdio.h>
int main ()
{
pid_t fpid; //fpid表示fork函数返回的值
int count = 0;
fpid = fork();
if (fpid < 0)
printf("error in fork!");
else if (fpid == 0)
{
printf("i am the child process, my process id is %d/n", getpid());
printf("我是爹的儿子/n");//对某些人来说中文看着更直白。
count++;
}
else
{
printf("i am the parent process, my process id is %d/n", getpid());
printf("我是孩子他爹/n");
count++;
}
printf("统计结果是: %d/n", count);
return 0;
}
1
https://gitee.com/gao_ze_zheng/passage3.git
git@gitee.com:gao_ze_zheng/passage3.git
gao_ze_zheng
passage3
信息安全系统与设计
master

搜索帮助