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.
DosExitCode Function
◄Summary► ◄Details► ◄Example► ◄Back►
Returns
Word Two bytes, each holding exit information from the child
process most recently terminated
Description
The DosExitCode function returns the exit code passed from a child
process. It also returns other information about how the child
process terminated. DosExitCode returns the information in two
bytes.
A child process run with the Exec procedure returns a code when it
terminates. A process terminates either normally or by the Halt
procedure. DosExitCode returns the termination code to the parent
process.
The low byte of the return value contains the exit code passed from
a child process. By convention, a code value of 0 means no error.
However, it is up to the child process to establish a meaning for
each error value.
The high byte of the return value contains one of the following
codes, which indicate how the child process terminated:
Code Termination Condition
════ ═════════════════════════════
0 Normal termination
1 CTRL+C termination
2 Termination by device error
3 Termination by Keep procedure
After a particular child process has terminated, DosExitCode can
be used repeatedly to return the same exit code. However, the
information applies to the most recent child process, and a
subsequent child process may change the value returned by
DosExitCode.