Article View: comp.lang.fortran
Article #6580Re: Passing parameter when loading a Fortran program
From: Chad A. English
Date: Wed, 03 Dec 1997 00:00
Date: Wed, 03 Dec 1997 00:00
33 lines
1639 bytes
1639 bytes
DMASYB wrote: > > Can anyone help me with this: How to pass a parameter to a program when > loading it. > For example: Program name is ANYPROG.EXE > The parameter is PARAM1 > I want to execute the program like this: > > ANYPROG.EXE PARAM1 > > Any help would be greatly appreciated. > Thanks. Many compilers support the sub GETARG which will retrieve character strings from the command line. ========== PROGRAM ReadCmndLine INTEGER I CHARACTER PARAM1 I = 1 CALL GETARG(I,PARAM1) ========== By indexing I you can retrieve multiple parameters from the command line. Hope that helps! -- Chad A. English Hydrologist USGS, Menlo Park cenglish@usgs.gov
Technical Details
Message-ID:
<3485A01A.167E@usgs.gov>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<eO0dwSAA9GA.264@upnetnews04>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcffb,5596e8b35b5f590 X-Google-Attributes: gidfcffb,public X-Google-Thread: f754b,5596e8b35b5f590 X-Google-Attributes: gidf754b,public X-Google-Thread: 167b2b,5596e8b35b5f590 X-Google-Attributes: gid167b2b,public X-Google-Thread: 1094ba,5596e8b35b5f590 X-Google-Attributes: gid1094ba,public X-Google-Thread: f9607,5596e8b35b5f590 X-Google-Attributes: gidf9607,public From: "Chad A. English" <cenglish@usgs.gov> Subject: Re: Passing parameter when loading a Fortran program Date: 1997/12/03 Message-ID: <3485A01A.167E@usgs.gov> X-Deja-AN: 294910474 Sender: news@igsrsparc2.er.usgs.gov (Janet Walz (GD) x6739) References: <eO0dwSAA9GA.264@upnetnews04> X-Nntp-Posting-Host: sfbay7.wr.usgs.gov Organization: US Geological Survey, Menlo Park Newsgroups: comp.lang.fortran,fj.lang.fortran,microsoft.public.fortran,slac.lang.fortran,tw.bbs.comp.lang.fortran