父进程等待子进程退出

#include <sys/types.h> #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> int main() { pid_t pid; int cnt = 0; pid = fork(); if(pid>0) { wait(NULL); while(1) { printf(“th
相关文章
相关标签/搜索