www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1995/11/07/01:02:39

Date: Tue, 7 Nov 1995 07:43:18 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: "A.Appleyard" <A DOT APPLEYARD AT fs2 DOT mt DOT umist DOT ac DOT uk>
Cc: DJGPP AT sun DOT soe DOT clarkson DOT edu
Subject: Re: Getting the return code of a program called by a Gnu C program

On Mon, 6 Nov 1995, A.Appleyard wrote:

>   If a program does this:-
>   int i = system("MIAOW");
>   /* MIAOW.EXE is a program that runs and then exits with fault code N */
>   How can the Gnu C/C++ program find the error code that MIAOW.EXE returned?

Don't use system(), use spawn* family of the library functions.  They 
will return the exit status of MIAOW.EXE (should be a number, but in this 
case it could sound like a cat ;-), or a negative number if MIAOW 
couldn't be run (like when COMMAND.COM says ``Bad command or filename'').

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019