Fortran Library Reference

iargc: Get the Number of Command-Line Arguments

The function is called by:

m = iargc()

Return value 

INTEGER*4

Output 

Number of arguments on the command line  

Example: iargc and getarg, get argument count and each argument:


demo% cat yarg.f
    character argv*10
    INTEGER*4 i, iargc, n
    n = iargc()
    do 1 i = 1, n
     call getarg( i, argv )
 1   write( *, '( i2, 1x, a )' ) i, argv
    end
demo% f77 -silent yarg.f
demo% a.out *.f 
1 first.f
2 yarg.f

See also execve(2) and getenv(3F).