[comp.lang.pascal] halt

Mark@hamster.business.uwo.ca (Mark Bramwell) (03/19/91)

I am trying to write a very simple program but I am having a difficulty with
the halt function.  I want the program to end and set an errorlevel so I can
test it via a batch file.

Example:

program test;
begin
 halt(1);
end.

should it not give an errorlevel of 1?

XYZ.BAT contains:
test
if errorlevel 1 ver

It does not print out the dos version.  I beleive I have used this in the
past, but I only have 6.0 loaded on my machine now.  Any ideas?  Does anyone
with 5.x want to try it?

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Mark Bramwell, VE3PZR                Located in sunny London, Ontario

Internet: mark@hamster.business.uwo.ca  IP Address: 129.100.22.100
  Packet:  VE3PZR @ VE3GYQ               UWO Phone: (519) 661-3714

amead@s.psych.uiuc.edu (alan mead) (03/19/91)

Mark@hamster.business.uwo.ca (Mark Bramwell) writes:

>program test;
>begin
> halt(1);
>end.

>should it not give an errorlevel of 1?

>XYZ.BAT contains:
>test
>if errorlevel 1 ver

>It does not print out the dos version.  I beleive I have used this in the
>past, but I only have 6.0 loaded on my machine now.  Any ideas?  Does anyone
>with 5.x want to try it?

It worked when I changed the errorlevel to 2 (I introduced a bug and didn't
try 1).  I believe I've used 1 before successfully.
-alan mead : amead@s.psych.uiuc.edu

ts@uwasa.fi (Timo Salmi) (03/19/91)

In article <26295@adm.brl.mil> Mark@hamster.business.uwo.ca (Mark Bramwell) writes:
>I am trying to write a very simple program but I am having a difficulty with
>the halt function.  I want the program to end and set an errorlevel so I can
:
>XYZ.BAT contains:
>test
>if errorlevel 1 ver
:

Your problem is not with the halt command but with your syntax in
using errorlevel.  Try eg consulting your MsDos manual, or get
/pc/ts/tsbat24.arc from our site for studing batch programming.  The
latter contains many useful batch tricks and much general batch
knowledge. 

...................................................................
Prof. Timo Salmi        
Moderating at garbo.uwasa.fi anonymous ftp archives 128.214.12.37
School of Business Studies, University of Vaasa, SF-65101, Finland
Internet: ts@chyde.uwasa.fi Funet: gado::salmi Bitnet: salmi@finfun