Difference between revisions of "TProcess"
From Lazarus wiki
Jump to navigationJump to searchLine 1: | Line 1: | ||
+ | {{TProcess}} | ||
+ | |||
'''TProcess''' [[image:tprocess.png]] is an invisible component on the [[System tab]] of the [[Component Palette]] that enables easy execution of external programs. | '''TProcess''' [[image:tprocess.png]] is an invisible component on the [[System tab]] of the [[Component Palette]] that enables easy execution of external programs. | ||
Line 14: | Line 16: | ||
See the TProcess examples in [[Executing External Programs#TProcess|Executing External Programs]]. | See the TProcess examples in [[Executing External Programs#TProcess|Executing External Programs]]. | ||
− | If there is need for | + | If there is need for [[UTF-8]] string passing, use TProcessUTF8 instead. |
== See also == | == See also == |
Revision as of 09:28, 5 March 2017
│
English (en) │
suomi (fi) │
français (fr) │
polski (pl) │
TProcess is an invisible 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