Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

why AX=4C01h and AX=4c02h ??

Status
Not open for further replies.

syskplim

Technical User
Nov 17, 2003
46
MY
i only know that ax=4c00h/ah=4ch is for termination but why someone put 4C01h and 4C02h in their program?
 
Hi.

4c00 gives a dos return code of 00

4c01 gives a dos return code of 01

4c02 gives a dos return code of 02.

The return code can be tested in a batch file to determine how the program terminated.

This is done using the IF ERRORLEVEL construct.

rgds
Zeit.
 
lets say my test.com has 3 functions each returns 4C01, 4C02 and 4C03.

then i can put ERRORLEVEL command in batch like bellow?

----------------------------TOF
@ echo off
test
if errorlevel 1 goto work1
if errorlevel 2 goto work2
if errorlevel 3 goto work3

:work1
.
.
goto end

:work2
.
.
goto end

:work3
.
.

:end
------------------------EOF
 
Yes, you've got the idea!

programs generally return 00 to indicate success, with any other return value indicating some sort of error has occurred.

This is what I tend to do when writing utilities.

However, you are free to use it as it suits you.

Many dos utilities were written that gave return values that allowed batch files to access system functions.

rgds
Zeit.
 
Just want to add a comment about this

Many dos utilities were written that gave return values that allowed batch files to access system functions

It is also a good reason to do that. So the user knows what is the status :)

Regards

-- AirCon --
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top