O'Reilly logo

Advanced UNIX Programming by Warren W. Gay

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required