标签:fail while erro clu pre include main int ==
#include <stdio.h>
#include <unistd.h>
int main()
{
int i = 10;
pid_t pid;
printf("Father‘s pid:%d\n", getpid());
pid = fork();
if(pid < 0)
{
perror("fork failure!");
return -1;
}
else if(pid == 0)
{
//while(1)
{
i++;
printf("Child‘s i = %d\n", i);
sleep(1);
}
}
else
{
printf("Child‘s pis:%d\n", pid);
//while(1)
{
printf("Father‘s i = %d\n", i);
sleep(1);
}
sleep(1);
}
return 0;
}
标签:fail while erro clu pre include main int ==
原文地址:https://www.cnblogs.com/Janly/p/14848824.html