How to read the return code from a child process
I use fork and execv to execute a child process. In the parent program, I have this:
int status;
wait(&status);
cout << "return code = " << status << endl;
Will that wait for the child process to terminate and then display开发者_如何学JAVA it's return code?
You should use waitpid() if want to get status of specified child process. wait()
will return status of first finished child process.
yes, it should from what i read http://linux.die.net/man/2/wait
精彩评论