'===========================================================================
' Subject: ERRORLEVEL OF RETURNED SHELL       Date: 12-17-92 (21:25)       
'  Author: Geoffrey Liu                       Code: QB, QBasic, PDS        
'  Origin: QBTIPS_?.DOC                     Packet: DOS.ABC
'===========================================================================
'> I have looked in several books for the QuickBasic equivalent of Batch
'>language's ERRORLEVEL command.  I couldn't get ERRORLEVEL to work in QB
'>and I am wondering if there is a command that does the same thing. I'm
'> trying to get QuickBasic to take Errorlevels from a program that I am
'> SHELLing out to run.

DECLARE FUNCTION ErrorLevel% () 'Returns errorlevel of shelled program

FUNCTION ErrorLevel%

   'Purpose : To check the error level of a program returning from shell
   'Input   : none (well, helps if you did shell a program first)
   'Return  : The errorlevel returned from the last shelled program

   DEF SEG = 0
   ErrorLevel% = PEEK(&H4FE)
   DEF SEG
END FUNCTION
