Definition | #include <stdlib.h> int system(const char *cmd);
| |
Return val. | 0 | The system command was executed successfully (return value of the corresponding system command: 0). |
-1 | The system command was not executed successfully (return value of the system command: error code | |
The return value remains undefined (see "Notes") if control is not returned to the program following the system command. | ||
Notes | The system command must not exceed a maximum length of 2048 characters and need not be specified with the system slash (/). After certain commands (START-PROG, LOAD-PROG, CALL-PROCEDURE, DO, HELP-SDF), control is not returned to the calling program. If a program permits such premature program terminations, it should flush buffers ( The | |
Example | #include <stdio.h> #include <stdlib.h> int main(void) { char cmd[225]; int result; printf("Please enter system command\n"); gets(cmd); result = system(cmd); printf("Return value: %d\n", result); return 0; } |