Setting DOS errorlevel in C (How?)
John Stanley
john at viper.Lynx.MN.Org
Wed Mar 23 09:56:18 AEST 1988
In article <11480009 at hpsmtc1.HP.COM> swh at 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 at viper.UUCP)
Software Consultant - DynaSoft Systems
UUCP: ...{amdahl,ihnp4,rutgers}!meccts!viper!john
More information about the Comp.lang.c
mailing list