如题
以下是源代码
#include"wrapper"
int main()
{
pid_t pid;
int x = 1;
pid=fork();
if(pid == 0){
x=x+1;
printf("child:x=%d\n",x);
}
if(pid > 0){
x=x-1;
printf("parent:x=%d\n",x);
}
sleep(10);
}
如题
以下是源代码
#include"wrapper"
int main()
{
pid_t pid;
int x = 1;
pid=fork();
if(pid == 0){
x=x+1;
printf("child:x=%d\n",x);
}
if(pid > 0){
x=x-1;
printf("parent:x=%d\n",x);
}
sleep(10);
}
#include"wrapper"
改为
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>