Portability Function: Sends a command to the shell as if it had been typed at the command line.
Module: USE IFPORT
Syntax
result = SYSTEM (string)
string
(Input) Character*(*). Operating system command.
Results
The result type is INTEGER(4). The result is the exit status of the shell command. If -1, use IERRNO to retrieve the error. Errors can be one of the following:
On Windows* systems, the calling process waits until the command terminates. To insure compatibility and consistent behavior, an image can be invoked directly by using the Windows API CreateProcess( ) in your Fortran code.
Commands run with the SYSTEM routine are run in a separate shell. Defaults set with the SYSTEM function, such as current working directory or environment variables, do not affect the environment the calling program runs in.
The command line character limit for the SYSTEM function is the same limit that your operating system command interpreter accepts.
Compatibility
CONSOLE STANDARD GRAPHICS QUICKWIN GRAPHICS WINDOWS DLL LIB
See Also
Example
USE IFPORT
INTEGER(4) I, errnum
I = SYSTEM("dir > file.lst")
If (I .eq. -1) then
errnum = ierrno( )
print *, 'Error ', errnum
end if
END