process.c
来自「数据结构学习点滴」· C语言 代码 · 共 27 行
C
27 行
#include "myhdr.h"
int
main()
{
pid_t pid;
pid=fork();
if(pid<0)
{
printf("create process error\n");
exit(-1);
}
else
if(pid==0)
{
sleep(2);
printf("pid==0 the id is:%d\n",getpid());
printf("pid==0 the father id is:%d\n",getppid());
}
else
{
printf("pid>0 the id is:%d\n",getpid());
printf("pid>0 the father id is:%d\n",getppid());
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?