Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

GET_COMMAND_ARGUMENT

Intrinsic Subroutine: Returns a command line argument of the command that invoked the program. Intrinsic subroutines cannot be passed as actual arguments.

CALL GET_COMMAND_ARGUMENT (number [, value, length, status, errmsg])

number

(Input) Must be a scalar of type integer. It must be non-negative and less than or equal to the value returned by the COMMAND_ARGUMENT_COUNT function. Its value is the position of the command-line argument to retrieve. The command itself is argument number zero.

value

(Output; optional) Must be a scalar of type default character. If specified, its value is the returned command-line argument or all blanks if the value is unknown.

length

(Output; optional) Must be a scalar of type integer. If specified, its value is the length of the returned command-line argument or zero if the length of the argument is unknown. This length includes significant trailing blanks. It does not include any truncation or padding that occurs when the argument is assigned to the value argument.

status

(Output; optional) Must be a scalar of type integer. If specified, its value is the returned completion status. It is assigned the value -1 if the value argument is present and has a length less than the significant length of the command argument specified by number. It is assigned a processor-dependent positive value if the argument retrieval fails. Otherwise, it is assigned the value zero.

errmsg

(Input; output; optional) Must be a scalar of type default character. If an error occurs, it is assigned a processor-dependent explanatory message; otherwise, it is unchanged.

GET_COMMAND_ARGUMENT returns command-line arguments as they were entered. There is no case conversion.

Example

See the example in COMMAND_ARGUMENT_COUNT.