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. While the 'pos' function is fine and it is defined on the same place.
Cheers,
miklos
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. While the 'pos' function is fine and it is defined on the same place.
Look to pexecutedemo.pas in the doc/gpc/demos directory
Maurice
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
On Mon, 8 Sep 2003, Frank Heckenbach wrote:
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;
Thank you Frank, that was it. Does it mean there are two gpc units, one is built in as default ('pos' comes from there) and the second one is included in the distribution as source only? (This one contains more extra functions like 'execute'.)
Cheers,
miklos
Miklos Cserzo wrote:
On Mon, 8 Sep 2003, Frank Heckenbach wrote:
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;
Thank you Frank, that was it. Does it mean there are two gpc units, one is built in as default ('pos' comes from there) and the second one is included in the distribution as source only? (This one contains more extra functions like 'execute'.)
No, the built-in things are, well, built into the compiler ;-) and not imported from a unit. (In the future, we may do it via a unit, or rather, another interface of the GPC module, but it requires qualified identifiers (to avoid name conflicts) and special handling of the "magic" built-ins, so we can't do it yet.)
The actual routines are the same, of course, wether built-in or imported from GPC.
Frank