In System library function in c use the command int system(const char *command) name or program name to the host environment and also executed command processor and returns the command after complete the task that is given in the c program.
Parameters For System() function program in c :
Command:- This string in c program containing the name of requested variable.
Return the status of the command at the success and returned is -1 on error.
Example:-
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>int main () { char command[50]; strcpy( command, "-l" ); system(command); return(0); }
Example:-
This function list down the dir file with the help of c program
#include <stdio.h> #include <string.h>int main () { char command[50]; strcpy( command, "dir" ); system(command); return(0); }
system program in c |