Core Function System
System( <expression> )
Contents |
Description
Invokes the command processor to execute a command.
If command is a null, 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.
Parameters
expression
The expression can either be NULL to check if the command processor exists or a string to execute a command.
Return Value
If command is a null, the function returns a non-zero value in case a command processor is available and a zero value if it is not.
If command is not a null (ie a string), 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.
Remarks
None.
Example
print ("Checking if processor is available...\n"); if (system(NULL)) print ("command processor is available and ready to use\n"); else throw new exception("command is a null pointer"); printf ("Executing command ECHO Moo moo...\n"); my $i = system ("echo moo moo"); print ("The value returned was: $i.\n");