【求助!】写了一个deamon
程序代码:#include <stdio.h>
#include <unistd.h>
int main()
{
pid_t pid;
if(pid=fork()==0)
printf("child started\n");
if(pid==0){
// child process
int i;
for(i=0;i<10;i++){
printf("working %d\n",i);
sleep(1);
}
printf("done\n");
return 0;
}else{
//parcal process exits immediately
//so as to reparent the children.
return 0;
}
}
想这个deamon弄成后台运行的,但是他仍然是前台工作。为什么啊?

