lab4-1.c
来自「父子进程实现」· C语言 代码 · 共 30 行
C
30 行
#include <stdio.h>#include<stdlib.h>#include<unistd.h>#include<sys/types.h>#include <sys/wait.h>int main(void){ pid_t pid, pid2; while((pid=fork()) < 0); if(pid==0){ printf("The son1 start:\n"); if(execl("/etc/linfeng/test-8led-exe","","","NULL")<0) printf("linfeng is testing wrong. son1==!!!\n"); }else{ while((pid2=fork())<0); if(pid2==0){ sleep(5); printf("The son2 start:\n"); if(execl("/etc/linfeng/test-led-exe","","","NULL")<0) printf("linfeng is testing wrong. son2==!!!\n"); } } exit(0);}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?