
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>system</b>
[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
system
Usage
#include <stdlib.h>
int system(const char *string);
ANSI
Description
system causes string to be passed to the operating system command
processor as if the string had been typed in at the console. The current
program waits until the command is executed then resumes.
There is no way to determine the exit status of programs run using
system.Use one of the spawn functions if an exit status is required.
System cannot be used to set environment variables.
Example
#include <stdlib.h>
int main()
{
system("set >>path.log");
system("cat path.log");
system("rm path.log");
system("ls /w");
return EXIT_SUCCESS;
}
Return Value
If there was not enough available memory to execute the process,
then -1 is returned, else a 0 is returned.
See Also
exec, spawn
See Also: exec spawn
Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson