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 it's return code?
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 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