C examples for stdlib.h:system
function
<cstdlib> <stdlib.h>
Execute system command
int system (const char* command);
Parameter | Description |
---|---|
command | C-string system command |
#include <stdio.h> #include <stdlib.h> int main ()/*ww w. jav a 2 s .c o m*/ { int i; printf ("Checking if processor is available..."); if (system(NULL)) puts ("Ok"); else exit (EXIT_FAILURE); i=system ("cd a"); //i=system ("dir"); printf ("The value returned was: %d.\n",i); return 0; }