Solved

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

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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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…

733 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