Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

27. Program Execution > Executing a Shell Command: system()

Executing a Shell Command: system()

The system() function allows the calling program to execute an arbitrary shell command. In this section, we describe the operation of system(), and in the next section we show how system() can be implemented using fork(), exec(), wait(), and exit().

Note

In Talking to a Shell Command via a Pipe: popen() , we look at the popen() and pclose() functions, which can also be used to execute a shell command, but allow the calling program to either read the output of the command or to send input to the command.

#include <stdlib.h>

int system(const char *command);

  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint