Solved

How do I get a child-process's return value

Posted on 2003-11-19
5
1,765 Views
Last Modified: 2009-12-16
This is for a C++ program.

I have a program where I fork and exec to create a child process then waitpid to wait for it to end.  Then I need to get the value the child process returned but I cannot seem to find any system calls to do this.  How do I do this?   (I probably just need the name of the system call, I can probalby take it from there.)
0
Comment
Question by:nietod
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 5

Accepted Solution

by:
mtmike earned 100 total points
ID: 9783118
You can use the WEXITSTATUS macro to extract the exit code from the status returned by waitpid()

waitpid(pid, &status, 0);
exitcode = WEXITSTATUS(status);
0
 
LVL 22

Author Comment

by:nietod
ID: 9786748
I'm SOOOOO stupid!!!!!

I don't know how I missed that.


thanks!!!!!
0
 
LVL 22

Author Comment

by:nietod
ID: 9786760
Out of curioisity.   I've been away from EE for a few months now and I'm finidinmg it now has a bizzare layout.  the questions themelfs are scrolled WAY of the right side of the  page.   Are other people experieincing this?  Is this under transition?
0
 
LVL 5

Expert Comment

by:mtmike
ID: 9800345
Under netscape/mozilla, the questions are way on the right side, but konqueror and opera display EE pages normally. IE displays them correctly too.
0
 
LVL 30

Expert Comment

by:Axter
ID: 11017007
If you're having problems using the new look, you can still access the old look by prefixing oldlook.
Example:
http://oldlook.experts-exchange.com:8080/Programming/Programming_Platforms/Linux_Programming/Q_20803247.html
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question