# 标准库stdlib.h函数system() **函数原型** ```c int system(const char* command); ``` **说明** 执行系统命令。 **参数** ```c command: C-style字符串的命令, 或者一个空指针 ``` **返回值** 如果command是一个空指针,则函数在命令处理器可用的情况下返回非零值,不可用的情况下返回零值。 如果command不是一个空指针,那么根据系统内执行的命令的结果返回。 **实例** ```c #include /* printf */ #include /* system, NULL, EXIT_FAILURE */ int main () { int i; printf ("Checking if processor is available..."); if (system(NULL)) puts ("Ok"); else exit (EXIT_FAILURE); printf ("Executing command DIR...\n"); i=system ("dir"); printf ("The value returned was: %d.\n",i); return 0; } ```