#include <pthread.h> #include <stdio.h> #include <unistd.h> #include <signal.h> int main() { pid_t fpid; fpid=fork(); if(fpid==0){printf("I am child ");} else {printf("I am father ");} }
输出结果:
I am fatherI am child