Path: utzoo!mnetor!uunet!husc6!uwvax!umn-d-ub!umn-cs!meccts!viper!john From: john@viper.Lynx.MN.Org (John Stanley) Newsgroups: comp.lang.c Subject: Re: Setting DOS errorlevel in C (How?) Message-ID: <739@viper.Lynx.MN.Org> Date: 22 Mar 88 23:56:18 GMT References: <4831@sigi.Colorado.EDU> <11480009@hpsmtc1.HP.COM> Reply-To: john@viper.Lynx.MN.Org (John Stanley) Organization: DynaSoft Systems Lines: 34 In article <11480009@hpsmtc1.HP.COM> swh@hpsmtc1.HP.COM (Steve Harrold) writes: >Re: setting errorlevel from C > >For Microsoft C use: > >int main(....) >... >{ > int rc ; > ... > rc = ... ; > ... > return rc; >} > >Use of exit(rc) would also succeed. > >--------------------- >Steve Harrold ...hplabs!hpsmtc1!swh > HPG200/13 > (408) 447-5580 >--------------------- If you want your code to be portable, don't use the return-from-main method. Any program that you might want to port should use exit(rc) to return a non-zero exit code. This is the only method that works under all C compilers and since exit() is quite offen included in the initial object-code module it's not likely to make your program much larger... --- John Stanley (john@viper.UUCP) Software Consultant - DynaSoft Systems UUCP: ...{amdahl,ihnp4,rutgers}!meccts!viper!john