🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.os.ms-windows.programmer.misc
Article #2287

Re: MS-Fortran: filename from cmd line?

#2287
From: Martin Hepperle
Date: Sat, 23 Jan 1993 20:16
50 lines
2819 bytes
In article <727727885snz@chrism.demon.co.uk> chris@chrism.demon.co.uk writes:
>In article <davidw.727655487@auck.irl.cri.nz> davidw@auck.irl.cri.nz writes:
>
>>I recently upgraded to MS-Fortran 5.1, which can generate Windows
>>programs. 
>>
>>I wish to associate the input files for my Fortran simulation with 
>>the Windows .EXE file, AND get the input filename into the 
>>simulation for character manipulation to generate corresponding 
>>output filenames. 
>>
>>Eg, associate *.INP with SIMULATE.EXE. Now I want to be able to
>>double-click on XYZ.INP (in FileManager) to run SIMULATE, opening
>>XYZ.INP as input and generating XYZ.OUT for output. 
>>
>>My local Microsoft support provided information about accessing
>>the PSP or PDB at the start of the app, and a Windows call:
>>GetCurrentPDB(). Before looking into something that seems rather
>>complex to me, has anyone solved this one already?
>>
>
>I've converted quite a number of FORTRAN codes to run under Windows.
>My advice would be to convert your main program to a SUBROUTINE, and
>add a small front end program in C which calls the FORTRAN code. That
>way you can use all the standard C command-line parsing stuff.
> 
But why do you want to make it so complicated ?

FORTRAN 5.1 can eccess the command line arguments directly, I have
used it in all my FTN programs: if there are cmd-line options,
they are used, otherwise the user is prompted for filenames etc.

There are two functions, discription in the manuals, I am recalling
them from memory here:
INTEGER FUNCTION NARGS() ............ returns number of arguments
INTEGER FUNCTION GETARG(N,STRING) ... returns argument no. N

Do I hope this helps ?

Martin.
________________________________________________________

      Martin J. Hepperle          MMMMMMMMMMMMH   HHH
     Universitaet Stuttgart       M   MMM   MMH   HHH
       Pfaffenwaldring 9          M   MMM   MMHHHHHHH
     D-7000 Stuttgart 80          M   MMM   MMH   HHH
 Germany, Europe, World, Universe M   MMM   MMH   HHH
     PLEASE USE THIS RETURN ADDRESS ONLY:
    martin@mecha2.verfahrenstechnik.uni-stuttgart.de
________________________________________________________
Technical Details
Message-ID: <1js92sINN6jg@info2.rus.uni-stuttgart.de>
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!news.belwue.de!news.uni-stuttgart.de!patricia!martin
References: <davidw.727655487@auck.irl.cri.nz> <727727885snz@chrism.demon.co.uk>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!sparky!uunet!mcsun!Germany.EU.net!ira.uka.de!news.belwue.de!news.uni-stuttgart.de!patricia!martin
From: martin@patricia.verfahrenstechnik.uni-stuttgart.de (Martin Hepperle)
Newsgroups: comp.os.ms-windows.programmer.misc
Subject: Re: MS-Fortran: filename from cmd line?
Date: 23 Jan 1993 20:16:28 GMT
Organization: Institute A for Mechanics, University of Stuttgart, Germany
Lines: 50
Distribution: world
Message-ID: <1js92sINN6jg@info2.rus.uni-stuttgart.de>
References: <davidw.727655487@auck.irl.cri.nz> <727727885snz@chrism.demon.co.uk>
NNTP-Posting-Host: rusmv1.rus.uni-stuttgart.de