17 lines
297 B
C
17 lines
297 B
C
|
#include <stdio.h>
|
||
|
#include <unistd.h>
|
||
|
|
||
|
int main(void)
|
||
|
{
|
||
|
pid_t pid;
|
||
|
printf("father \n");
|
||
|
printf("fork \n");
|
||
|
pid = fork();
|
||
|
if(!pid)
|
||
|
printf("child \n");
|
||
|
else if(pid>0)
|
||
|
printf("i m the parent ,child pid %d\n",pid);
|
||
|
else
|
||
|
printf("fork failed \n");
|
||
|
}
|