Command Execution

The function system(char *s) executes the command contained in the character string s, then resumes execution of the current program. The contents of s depend strongly on the local operating system. As a trivial example, on UNIX systems, the statement:

system("date");

causes the program date to be run; it prints the date and time of day on the standard output. system returns a system-dependent integer status from the command executed. In the UNIX system, the status return is the value returned by exit.

Note

You might start to feel a slight tickle when reading the explanation above. And your feeling is absolutely right, this is incredibly dangerous. Imagine passing user input to system(), the user inputs "rm -rf /", and presto your entire system is gone.
Though only slightly exaggerated, please try not to use this function and if you do, make sure to sanitize whatever you pass to it. You have been warned.