From: firewind Newsgroups: comp.lang.c,comp.os.msdos.djgpp Subject: Re: Executing a program and obtaining its return value Date: Wed, 8 Apr 1998 21:15:30 -0600 Organization: All USENET -- http://www.Supernews.com Lines: 23 Message-ID: References: <352C1A0D DOT 77EAB402 AT codex DOT nu> <352C2306 DOT 2F72 AT cs DOT com> NNTP-Posting-Host: 22584 AT 209 DOT 12 DOT 189 DOT 41 Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII In-Reply-To: <352C2306.2F72@cs.com> To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk On Wed, 8 Apr 1998, John M. Aldrich wrote: > system()'s return value is the program's exit code. If this doesn't > seem to work for you, post a small example that demonstrates it. I have > done it myself with success. Well, almost; system() returns whatever the command processor returns, which may or may not be what the executed program returned. MS-DOS's 'command.com,' for instance, is infamous for providing not-quite-accurate return codes. > There are two major problems. The first is that the program's exit code > is only 8 bytes in the operating system, It is? How do you know? (Oh, wait-- this is a crosspost. Nevermind. :) -- (initiator of the campaign for grumpiness where grumpiness is due in c.l.c) Attempting to write in a hybrid which can be compiled by either a C compiler or a C++ compiler produces a compromise language which combines the drawbacks of both with the advantages of neither. -- John Winters in comp.lang.c