iOS Developer Library Developer
ADC Home > Reference Library > Reference > Mac OS X > Mac OS X Man Pages


This document is a Mac OS X manual page. Manual pages are a command-line technology for providing documentation. You can view these manual pages locally using the man(1) command. These manual pages come from many different sources, and thus, have a variety of writing styles.

For more information about the manual page format, see the manual page for manpages(5).

SYSTEM(3)                BSD Library Functions Manual                SYSTEM(3)

     system -- pass a command to the shell

     Standard C Library (libc, -lc)

     #include <stdlib.h>

     system(const char *command);

     The system() function hands the argument command to the command inter-preter interpreter
     preter sh(1).  The calling process waits for the shell to finish execut-ing executing
     ing the command, ignoring SIGINT and SIGQUIT, and blocking SIGCHLD.

     If command is a NULL pointer, system() will return non-zero if the com-mand command
     mand interpreter sh(1) is available, and zero if it is not.

     The system() function returns the exit status of the shell as returned by
     waitpid(2), or -1 if an error occurred when invoking fork(2) or
     waitpid(2).  A return value of 127 means the execution of the shell

     sh(1), execve(2), fork(2), waitpid(2), popen(3)

     The system() function conforms to ISO/IEC 9899:1990 (``ISO C90'') and is
     expected to be IEEE Std 1003.2 (``POSIX.2'') compatible.

BSD                              June 4, 1993                              BSD