fork() always return 0 even in the parent process
my code is very simple:
int pid, status;
printf("parent process id=%d, to call fork\n",getpid());
printf("fork return pid=%s\n",pid);
//-----below the codes are executed by only parent process
else if (pid>0)
but everytime I can only get two fork return pid=0. In parent process, the pid returned by fork() should be >0 and equal to the child process id.
what is wrong with the code ?
thanks... Guru !