Use C system function to call system command
Syntax
C system function has the following format.
int system(const char *str);
Header
C system function is from header file stdlib.h.
Description
C system function passes the string as a command to the command processor and returns zero on success or nonzero on error.
Example
Use C system function to call system command. and display the contents of the current working directory in window system:
#include <stdlib.h>
//w ww. j a va 2s.co m
int main(void)
{
printf("%s",system("dir"));
}