Exforsys

Online Training

Confused on Return Status

This is a discussion on Confused on Return Status within the C and C++ forums, part of the Programming Talk category; I am using UNIX operating system and now I am trying out quite a number of programs in C programming ...


Go Back   Exforsys > Programming Talk > C and C++

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 05-10-2007, 04:01 PM
Senior Member
 
Join Date: Apr 2006
Posts: 141
Adrian is on a distinguished road
Thumbs up Confused on Return Status

I am using UNIX operating system and now I am trying out quite a number of programs in C programming language in my UNIX environment. I recently came across a function named as system() and thought of trying out this by a sample program to get idea about this function. I wrote the below C code for that

main()
{
int a = system("excel.exe");

}

I know that the above would open excel and exist from this only when the users exit from this. But the point I am confused is what is the return status from this system() function. Will it be the exit code of the excel process? Kindly clarify me on this.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-13-2007, 10:50 AM
Senior Member
 
Join Date: Apr 2006
Posts: 139
Ralph is on a distinguished road
Many might think that the function system() would return the exit code of the process initiated namely excel.exe. But it is wrong. The system() function instead returns the exit code of the shell that initiates the process. In your example the system() function would return the exit code of the shell that initiated excel and would not return Excel’s exit status.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads

Thread Thread Starter Forum Replies Last Post
RPN/RPL Calculator implementations, list of, regular post [long, FAQ] Craig A. Finseth Tech FAQ 0 06-14-2004 10:34 AM
comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) Steve Summit Tech FAQ 0 06-01-2004 07:01 AM
comp.lang.c Answers to Frequently Asked Questions (FAQ List) Steve Summit Tech FAQ 0 06-01-2004 07:00 AM
comp.lang.c Answers (Abridged) to Frequently Asked Questions (FAQ) Steve Summit Tech FAQ 0 05-15-2004 07:00 AM
RPN/RPL Calculator implementations, list of, regular post [long, FAQ] Craig A. Finseth Tech FAQ 0 04-12-2004 10:27 AM


All times are GMT -4. The time now is 12:06 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0
Copyright 2004 - 2007 Exforsys Inc. All rights reserved.