Name | Description | Notes | Source | Availability | |||||||
---|---|---|---|---|---|---|---|---|---|---|---|
system() |
Execute environment command | (·) | <stdlib.h> |
C89 | C90 | C95 | C99 | C11 |
#include <stdlib.h>
int system(const char *cmd);
system
passes the null-terminated string at cmd
to the environment for execution as a command,
and waits for the command to complete. The function returns
the result of the command. On many systems, if the command is
another C program, this will be its exit status.
Formally, however, the result is implementation-defined.
Of course, the external command could influence the future running of the invoking program in other ways. For example, the command could explicitly cause the invoking program to terminate.
It's possible that the environment does not support the
execution of textual commands. In that case, system(NULL)
will return zero.