Hello,

I've written the following simple program:

#include <cstdlib>

int main( )
{
  // /fff does not exist
  int return_value = system("ls -l /fff"); 
  cout << "\n Return Value: " << return_value << "\n";
  return return_value;
}

When I compile this and run it from bash I see "Return
Value: 256" at stdout as I'd expect.  However, I then
immediately 'echo $?' and bash spits back '0' rather
than '256.'  Is this correct?  Shouldn't $? hold the
return value of the last program run from bash (ie, my
c program?)  Thanks in advance for any replies.

-exits

__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to