Path: utzoo!mnetor!uunet!lll-winken!lll-lcc!ames!fxgrp!ljz From: ljz@fxgrp.fx.com (Lloyd Zusman) Newsgroups: comp.sys.ibm.pc Subject: Re: Setting DOS errorlevel in C (How?) Message-ID: Date: 18 Mar 88 15:04:20 GMT References: <4831@sigi.Colorado.EDU> Sender: news@fxgrp.UUCP Followup-To: comp.sys.ibm.pc Distribution: na Organization: FX Development Group, Inc., Mountain View, CA Lines: 27 In-reply-to: murillo@sigi.Colorado.EDU's message of 14 Mar 88 15:46:08 GMT In article <4831@sigi.Colorado.EDU> murillo@sigi.Colorado.EDU (Rodrigo Murillo) writes: Does someone out there know how to set the DOS errorlevel number in C? I want to write a batch file that can branch according to the value of this number: if errorlevel 1 echo Big... if errorlevel 2 echo Bigger... if errorlevel 3 echo Biggest. In most (all?) MSDOS C compilers, the exit() function will set errorlevel: main() { ... ... exit(3); } The above will set errorlevel to 3. Using "exit(N)" will set errorlevel to N. -- --- Lloyd Zusman Ma Bell: (415) 961-5183 FX Development Group, Inc. Internet: fxgrp!ljz@ames.arpa Mountain View, California UUCP: ...!ames!fxgrp!ljz