[fpc-pascal]Exit codes of called programs.

Michael Van Canneyt michael.vancanneyt at wisa.be
Wed Apr 16 16:22:52 CEST 2003


On Wed, 16 Apr 2003, Jonas Maebe wrote:

>
> On woensdag, apr 16, 2003, at 15:28 Europe/Brussels, A.J. Venter wrote:
>
> > OK so shell is out, after all I am not all that concerned with how bash
> > exited. Assignstream as well. I did not even know that dos exec could
> > work under Linux, I somehow seem to think this is a less than adequate
> > approach though.
>
> The "dos" unit is simply an implementation of Borland's Dos unit, ie.
> it has the same interface, but the implementation is completely
> OS-dependent. There's nothing bad about using it under Linux or Win32.
> It doesn't allow you to capture the output of a program though. popen()
> (in the Linux unit) does, but I don't know whether it allows you to get
> the exit code. Check the documentation (units.pdf).

It does if you use pclose() to close it the file.
The return value of pclose is the exit code of the program.

Michael.




More information about the fpc-pascal mailing list