Maurice Lombardi wrote:
Miklos Cserzo a écrit:
Hi Folks,
what is the way to execute an external Unix command from GPC? (Like 'sort -k6f xxx') According to the documentation the function 'execute' is defined in the RTS and it looks like the one I just need. However, I can not access it, I get the 'undefined identifier' error.
uses GPC;
While the 'pos' function is fine and it is defined on the same place.
`Pos' is also built-in (for BP compatibility).
Look to pexecutedemo.pas in the doc/gpc/demos directory
`PExecute' can be used if you want to read/write from/to a process via pipes. If this is not wanted (as I suppose here), `Execute' is more useful. If, for some reason (usually for security critical applications) you want to avoid the use of the shell, you can use `Pipe' (which will call the program directly) and pass `Null' to all file arguments.
Frank