• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1770
  • Last Modified:

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

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
nietod
Asked:
nietod
  • 2
  • 2
1 Solution
 
mtmikeCommented:
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
 
nietodAuthor Commented:
I'm SOOOOO stupid!!!!!

I don't know how I missed that.


thanks!!!!!
0
 
nietodAuthor Commented:
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
 
mtmikeCommented:
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
 
AxterCommented:
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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now