External Processes Without Pipes
The previous section demonstrated an easy method to create a pipe to an external process and either read its output or feed it input. It often happens, however, that C programs need only to invoke another process, without using a pipe. The standard C library provides the system(3) function for this purpose.
#include <stdlib.h> int system(const char *command);
In general, there are two ways to use the system(3) function: with a null argument or with a non-null command string argument.
Almost all systems document the fact that when system(3) is called with a null command pointer, the function call checks on the availability of the shell that would normally be used to carry out the command (system(3) for HPUX-11 ...
Get Advanced UNIX Programming now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.