开发者

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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜