Solved

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

Posted on 2003-11-19
5
1,760 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

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 demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

831 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