three.c~
来自「文件拷贝 在linux环境下开发的程序 虽然很简单」· C~ 代码 · 共 38 行
C~
38 行
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/wait.h>#include <stdlib.h>#include <stdio.h>
#include <pthread.h>
#include <linux/sem.h>
#include <linux/shm.h>int main( int argc, char *argv[] ){ pid_t p1,p2,p3,p4;
pid_t t1,t2,t3,t4;
int status; if((p1=fork())==0) { execv("./first",NULL); }else { if((p2=fork())==0) { execv("./second",NULL); }else{ if((p3=fork())==0) { execv("./third",NULL); }else{ waitpid(p1,&status,0);
waitpid(p2,&status,0); waitpid(p3,&status,0); } } } return 0;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?