GETARG — Get command line arguments#
- 
GETARG(POS, VALUE)#
- Retrieve the - POS-th argument that was passed on the command line when the containing program was invoked.- Parameters:
- POS – Shall be of type - INTEGERand not wider than the default integer kind;- POSgeq 0
- VALUE – Shall be of type - CHARACTERand of default kind.
 
- Returns:
- After - GETARGreturns, the- VALUEargument holds the- POSth command line argument. If- VALUEcannot hold the argument, it is truncated to fit the length of- VALUE. If there are less than- POSarguments specified at the command line,- VALUEwill be filled with blanks. If- POS= 0,- VALUEis set to the name of the program (on systems that support this feature).
 - Standard:
- GNU extension 
- Class:
- Subroutine 
- Syntax:
- CALL GETARG(POS, VALUE) 
- Example:
- PROGRAM test_getarg INTEGER :: i CHARACTER(len=32) :: arg DO i = 1, iargc() CALL getarg(i, arg) WRITE (*,*) arg END DO END PROGRAM 
- See also:
- GNU Fortran 77 compatibility function: IARGC — Get the number of command line arguments Fortran 2003 functions and subroutines: GET_COMMAND — Get the entire command line, GET_COMMAND_ARGUMENT — Get command line arguments, COMMAND_ARGUMENT_COUNT — Get number of command line arguments