BBS: Inland Empire Archive
Date: 07-24-92 (07:24)             Number: 179
From: BRENT ASHLEY                 Refer#: NONE
  To: JIM TANNER                    Recvd: NO  
Subj: Errorlevels                    Conf: (2) Quik_Bas
 > DECLARE SUB ExitWithErrorLevel ALIAS "_exit" (BYVAL ErrLvl%)
 > ExitWithErrorLevel 5

JT>How/Who determines the ErrorLevel number.  Is the 5 you
JT>have shown here one that you have setup or is it a DOS

You choose the number yourself.  Convention holds that 0 is
returned for no error, but beyond that, it's up to you.  For
instance, I wrote a program that looks for a string in a file.
You call it with INFILE FileName "String to find" and it returns
an errorlevel depending on what was found.  I chose the following

0 = String found OK
1 = String not found
2 = File not found
3 = Error processing file

I could, however, have let 0 be "string not found" and returned
errorlevel 1 to 255 as the line number the string was found on if
I had decided that route.

 X DeLuxe2 1.12 #10383 X

--- Maximus 2.00
 * Origin: Durham Systems (ONLINE!) (1:229/110)
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