LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 05-19-2009, 02:07 AM   #1
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Rep: Reputation: 23
how to get application return code


A c/c++ programming question if you don't mind:

A college is calling an application from system() and wants to inspect the applications return code.

I don't beleive system() return is useful here so any ideas?
 
Old 05-19-2009, 03:24 AM   #2
wje_lq
Member
 
Registered: Sep 2007
Location: Mariposa
Distribution: FreeBSD,Debian wheezy
Posts: 811

Rep: Reputation: 179Reputation: 179
Quote:
Originally Posted by DEF. View Post
A college is calling an application from system() and wants to inspect the applications return code.

I don't beleive system() return is useful here so any ideas?
Yes. To find out what the system() return is, look at the, um, RETURN VALUE section of man system:
Code:
RETURN VALUE
       The value returned is -1 on error (e.g.  fork(2) failed), and the
       return status of the command otherwise.  This latter return status is
       in the format specified in wait(2).  Thus, the exit code of the command
       will be WEXITSTATUS(status).  In case /bin/sh could not be executed,
       the exit status will be that of a command that does exit(127).
What part of this excerpt of the man page puzzles you?
 
Old 05-19-2009, 05:12 AM   #3
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Original Poster
Rep: Reputation: 23
Hmm, I'll try. I read the description on www.opengroup.org for system() but perhaps I misread it (it was rather wordy for a simple minded soul like me ).
 
Old 05-19-2009, 10:38 AM   #4
DEF.
Member
 
Registered: Apr 2009
Posts: 96

Original Poster
Rep: Reputation: 23
OK thanks
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
wget return code ferp Programming 9 11-06-2008 12:37 PM
request_region(...) return code BrooklynOutlier Programming 0 03-07-2006 09:22 PM
request_region return code BrooklynOutlier Slackware 0 03-06-2006 10:26 PM
dd return code barefootdoctor Linux - General 2 10-13-2005 12:54 PM
application return value prital Linux - Newbie 1 03-30-2005 09:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:50 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration