Difference between revisions of "TProcess"
From Free Pascal wiki
Jump to navigationJump to searchLine 1: | Line 1: | ||
{{TProcess}} | {{TProcess}} | ||
− | '''TProcess''' [[image:tprocess.png]] is | + | '''TProcess''' [[image:tprocess.png]] is a non-visual component on the [[System tab]] of the [[Component Palette]] that enables easy execution of external programs. |
Some of the benefits of using TProcess are that it is: | Some of the benefits of using TProcess are that it is: |
Revision as of 10:22, 17 March 2017
│
English (en) │
suomi (fi) │
français (fr) │
polski (pl) │
TProcess is a non-visual component on the System tab of the Component Palette that enables easy execution of external programs.
Some of the benefits of using TProcess are that it is:
- Platform Independent
- Capable of reading from stdout and writing to stdin.
- Possible to wait for a command to finish or let it run while your program moves on.
Important notes:
- TProcess is not a terminal/shell! You cannot directly execute scripts or redirect output using operators like "|", ">", "<", "&" etc. It is possible to obtain the same results with TProcess using pascal, some examples are below..
- Presumably on Linux/Unix: you must specify the full path to the executable. For example '/bin/cp' instead of 'cp'. If the program is in the standard PATH then you can use the function FindDefaultExecutablePath from the FileUtil unit of the LCL.
- On Windows, if the command is on the path, you don't need to specify the full path.
Example
See the TProcess examples in Executing External Programs.
If there is need for UTF-8 string passing, use TProcessUTF8 instead.
See also