This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: practical use of iargc() getarg()


On Fri, Aug 10, 2007 at 06:34:15AM +0000, RadSurfer wrote:
> Steve Kargl <sgk <at> troutmask.apl.washington.edu> writes:
> > On Fri, Aug 10, 2007 at 03:46:19AM +0000, RadSurfer wrote:
> > You need to use an internal read.
> >           PROGRAM test_getarg
> >             INTEGER :: i
> >             CHARACTER(len=32) :: arg
> >             real x
> >             DO i = 1, iargc()
> >               CALL getarg(i, arg)
> >               read(arg,*) x
> >             END DO
> >           END PROGRAM
> > The above is completely untested.
> 
> Works like a charm!  Beautiful.
> 
> by the way from gfortran.pdf, no example at all for iargc():
> 
> 6.94 IARGC ??? Get the number of command line arguments
> Description :
> Example :  See Section 6.79 [GETARG], page 79
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

There is an example.  In fact, carefully read the above code,
which is a edited version of the code from 6.79.

-- 
Steve


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]