errorlevels

 BBS: Inland Empire Archive
Date: 12-17-92 (21:25)             Number: 393
From: GEOFFREY LIU                 Refer#: NONE
  To: RYAN ADAMS                    Recvd: NO  
Subj: errorlevels                    Conf: (2) Quik_Bas
RA> I have looked in several books for the QuickBasic equivalent of Batch
RA>language's ERRORLEVEL command.  I couldn't get
RA>ERRORLEVEL to work in QuickBasic
RA>and I am wondering if there is a command that does the
RA>same thing.  I am trying
RA>to get QuickBasic to take Errorlevels from a program
RA>that I am SHELLing out to
RA>run.

        Here's the code I use.

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

                   Happy Holidays, Geoff.
---
 * DeLuxe* 1.26b #11507 * Paul Harvey fans always have a good day
--- FidoPCB v1.3 [ff053/x]
 * Origin: Canada Remote Systems, Mississauga, Ontario  (1:229/15)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET