Mail Archives: opendos/2002/01/02/19:18:59
The following is an extract from the TP/BP7 help ...
BTW, you can obtain TP5.5 for free, from the Borland web
site's museum. The "delay" routine doesn't time correctly on
modern PC's, but otherwise, this is a very handy little compiler.
You can also obtain the Frech version of TP7.01 for free,
including an updated "CRT" unit (with working "delay" routine),
from "www.borland.fr/download".
Joe.
Exec (procedure) (Dos unit)
===============================
Executes a specified program with a specified
command line.
Declaration:
procedure Exec(Path, CmdLine: string);
Target:
Real, Protected
Remarks:
Errors are reported in DosError. When
compiling a program that uses Exec, reduce the
"maximum" heap size; otherwise, there won't be
enough memory (DosError = 8).
See Also:
DosError
DosExitCode
SwapVectors
Sample Code:
{DOSXCODE.PAS}
{ Example for DosExitCode and Exec }
{$M $4000,0,0 } { 16K stack, no heap }
uses Dos;
var
ProgramName, CmdLine: string;
begin
Write('Program to Exec (full path): ');
ReadLn(ProgramName);
Write('Command line to pass to ',
ProgramName, ': ');
ReadLn(CmdLine);
WriteLn('About to Exec...');
SwapVectors;
Exec(ProgramName, CmdLine);
SwapVectors;
WriteLn('...back from Exec');
if DosError <> 0 then{ Error? }
WriteLn('Dos error #', DosError)
else
WriteLn('Exec successful. ',
'Child process exit code = ',
DosExitCode);
end.
> -----Original Message-----
> From: DONALD PEDDER [SMTP:jims_son AT jedi DOT apana DOT org DOT au]
> Sent: Wednesday, January 02, 2002 9:15 PM
> To: opendos AT delorie DOT com
> Subject: system calls
>
> Can someone here tell me how to call a DOS command from Pascal? I'm
> tearing my hair out after searching the web for a while (a "complete and
> comprehensive" guide to Pascal fails to mention system calls at all).
>
> My manual notes the existence of a DOS.FPD object, yet gives no clue
> how to use it. None of the example programs include it.
>
> I basically want to know how to do something like STRING:=DOS(find
> "searchstring" filename) - obviously I don't know what the syntax is to do
> this. :-)
>
> Thanks.
>
> dp.
>
- Raw text -