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

ID 767251
Date 7/13/2023
Public

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

Document Table of Contents

IARGC

Inquiry Intrinsic Function (Specific): Returns the index of the last command-line argument. It cannot be passed as an actual argument. This function can also be specified as IARG or NUMARG.

result = IARGC( )

Results

The result type is INTEGER(4). The result is the index of the last command-line argument, which is also the number of arguments on the command line. The command is not included in the count. For example, IARGC returns 3 for the command-line invocation of PROG1 -g -c -a.

IARGC returns a value that is 1 less than that returned by NARGS.

Example

integer(4) no_of_arguments
no_of_arguments = IARGC ()
print *, 'total command line arguments are ', no_of_arguments

For a command-line invocation of PROG1 -g -c -a, the program above prints:

total command line arguments are 3