Sign in Join
FPDoc Onlineexperiment

DosExitCode function

In unit Dos

Exit code of last executed program.

Declaration

pascal
function DosExitCode: Word

Description

DosExitCode contains (in the low byte) the exit-code of a program executed with the Exec call.

Errors

None.

See also

Example: ex5

pascal
Program Example5;
uses Dos;

{ Program to demonstrate the Exec and DosExitCode function. }

begin
{$IFDEF Unix}
  WriteLn('Executing /bin/ls -la');
  Exec('/bin/ls','-la');
{$ELSE}
  WriteLn('Executing Dir');
  Exec(GetEnv('COMSPEC'),'/C dir');
{$ENDIF}
  WriteLn('Program returned with ExitCode ',Lo(DosExitCode));
end.

An experiment, built from development snapshots. Not the official Free Pascal or Lazarus documentation.