Go to main content
Oracle Developer Studio 12.5 Man Pages

Exit Print View

Updated: June 2017
 
 

iargc(3F)

Name

getarg, iargc - get the kth command-line argument

Synopsis

subroutine getarg ( k, arg )
character*(*) arg
function iargc ()

Description

The statement call getarg( k , arg ) gets the kth command-line argument and puts it into arg.

The 0th argument is the command name.

The function iargc returns the argument count, which is the index of the last command-line argument.

EXAMPLE

 
demo% cat tesargs.f
     character argv*10
     integer i, iargc, m
     m = iargc()
     do i = 1, m
          call getarg ( i, argv )
          write( *, '( i2, 1x, a )' ) i, argv
     end do
     end
demo % a.out first second last
 1 first
 2 second
 3 last
demo%
     
      

Files

libfsu.a

See Also

execve(2), getenv(3F)