Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!bloom-beacon!tut.cis.ohio-state.edu!ucbvax!ucsfcgl!cgl.ucsf.edu!kneller From: kneller@cgl.ucsf.edu (Don Kneller) Newsgroups: comp.sys.ibm.pc Subject: Re: HELP: MSC system call Message-ID: <11624@cgl.ucsf.EDU> Date: 25 May 89 20:24:43 GMT References: <4267@druhi.ATT.COM> Sender: daemon@cgl.ucsf.edu Reply-To: kneller@socrates.ucsf.edu.UUCP (Don Kneller) Distribution: comp Organization: UCSF Computer Graphics Lab Lines: 28 In article <4267@druhi.ATT.COM> deln@druhi.ATT.COM (SloaneN) writes: >I'm having a problem with the return code from system(). What >appears to happen is that the return code (as the manual states) >indicates whether command.com could successfully execute the command >or not. How do I get the exit code of the spawned command? > >eg. exit_code= system( "cl -E ......" ); > >if "cl" fails, I still get a zero return code because the "system" >command successfully spawned "cl". What I want is the exit code >from "cl". The problem (which has been there forever), is that the system() call actually spawns the following: command /c cl -E ... That is, command.com is spawned and it in turn spawns cl. However, command.com does not return the return code of "cl -E ...", it returns 0. At one time I thought a version of MSDOS had fixed this, but it is still a problem in PCDOS 3.3, so maybe it was just a wishful thought. - don ----- Don Kneller UUCP: ...ucbvax!ucsfcgl!kneller INTERNET: kneller@cgl.ucsf.edu BITNET: kneller@ucsfcgl.BITNET