Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!wuarchive!rex!ukma!usenet.ins.cwru.edu!eagle!zargon.lerc.nasa.gov!pstowne From: pstowne@zargon.lerc.nasa.gov (Charlie Towne) Newsgroups: comp.lang.fortran Subject: Re: Command line arguements? Message-ID: <1991May30.135749.10529@eagle.lerc.nasa.gov> Date: 30 May 91 13:57:49 GMT References: Sender: news@eagle.lerc.nasa.gov Organization: NASA Lewis Research Center (Cleveland) Lines: 40 In article eesnyder@boulder.Colorado.EDU (Eric E. Snyder) writes: >I need to write a program that takes arguements from the >command line and passes them to variables with in the program. > >eg: > > a.out arg1 arg2 .... > >This must be amazingly simple but I can't find anything in >my SGI Iris 4D f77 manual. What do you call this and where >can I find out about it? See the getarg(3F) man page in the Iris-4D Fortran 77 Reference Manual Pages (Doc. number 007-0621-030). It can be used as follows: character*1 iargc,jargc c c-----get arguments from command line c call getarg(1,iargc) call getarg(2,jargc) read (iargc,'(i1)') iarg read (jargc,'(i1)') jarg The calls to getarg return the 1st and 2nd arguments in the character variables iargc and jargc. The internal reads convert the character variables to integers. Note that this example is for single digit integer arguments. >Disclaimer: > > Be nice-- I'm just a biologist:-) That's OK. I'm just an engineer. -- Charlie Towne Email: pstowne@zargon.lerc.nasa.gov MS 5-11 Phone: (216) 433-5851 NASA Lewis Research Center Cleveland, OH 44135