The easy way to run another program is to use the
function. This function does all the work of running a subprogram, but
it doesn't give you much control over the details: you have to wait
until the subprogram terminates before you can do anything else.
shto run the command. In particular, it searches the directories in
PATHto find programs to execute. The return value is
-1if it wasn't possible to create the shell process, and otherwise is the status of the shell process. See section Process Completion, for details on how this status code can be interpreted.
system function is declared in the header file
Portability Note: Some C implementations may not have any
notion of a command processor that can execute other programs. You can
determine whether a command processor exists by executing
system (NULL); if the return value is nonzero, a command
processor is available.
pclose functions (see section Pipe to a Subprocess) are closely related to the
system function. They
allow the parent process to communicate with the standard input and
output channels of the command being executed.
Go to the first, previous, next, last section, table of contents.