Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
Halt Procedure
◄Summary► ◄Details► ◄Example► ◄Back►
Argument
code Optional; integer expression representing the exit code to
pass to the calling program or to operating system (default
is 0)
Description
The Halt procedure ends execution of the program and returns
control to the calling environment.
The code argument passes exit information from the terminated
program to the program executing it or to DOS. Halt passes 0
if code is omitted. By convention, 0 means no error. However,
it is up to the terminating program to establish a meaning for
each error value.
The exit code may be examined with the DosExitCode function in a
parent process, or with the ERRORLEVEL option to the IF command
in a DOS batch file.
To run a custom exit procedure as part of the exit sequence,
install the address of the procedure in ExitProc──a pointer defined
in the System unit. Use custom exit procedures to clean up open
files, restore vectors, or trap run-time errors.