function
<cstdlib>
systemint system (const char* command);
Execute system command
Invokes the command processor to execute a command.If command is a null pointer, the function only checks whether a command processor is available through this function, without invoking any command.
The effects of invoking a command depend on the system and library implementation, and may cause a program to behave in a non-standard manner or to terminate.
If command is not a null pointer, the value returned depends on the system and library implementations, but it is generally expected to be the status code returned by the called command, if supported.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
/* system example : DIR */
#include <stdio.h> /* printf */
#include <stdlib.h> /* system, NULL, EXIT_FAILURE */
int main ()
{
int i;
printf ("Checking if processor is available...");
if (system(NULL)) puts ("Ok");
else exit (EXIT_FAILURE);
printf ("Executing command DIR...\n");
i=system ("dir");
printf ("The value returned was: %d.\n",i);
return 0;
}
If command is not a null pointer, it causes undefined behavior.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4