Visible to Intel only — GUID: GUID-03DA620C-3D89-40CA-A832-A944AFA48772
Visible to Intel only — GUID: GUID-03DA620C-3D89-40CA-A832-A944AFA48772
SYSTEM
Portability Function: Sends a command to the shell as if it had been typed at the command line.
USE IFPORT
result = SYSTEM (string)
string |
(Input) Character*(*). Operating system command. |
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:
E2BIG: The argument list is too long.
ENOENT: The command interpreter cannot be found.
ENOEXEC: The command interpreter file has an invalid format and is not executable.
ENOMEM: Not enough system resources are available to execute the command.
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.
USE IFPORT
INTEGER(4) I, errnum
I = SYSTEM("dir > file.lst")
If (I .eq. -1) then
errnum = ierrno( )
print *, 'Error ', errnum
end if
END