> -----Original Message-----
> From: Earnie Boyd [mailto:earnie@...]
> Sent: Wednesday, March 14, 2012 07:20
> To: MinGW Users List
> Subject: Re: [Mingw-users] How to associate filenames to unit numbers in a gfortran
> program without recompilation ?
> On Tue, Mar 13, 2012 at 9:52 PM, Claude Berger <bergerclaude@...> wrote:
> > I am a newcomer to MinGW and I have a very simple question. I
> > installed MinGW and ran simple FORTRAN programs using the gfortran
> > compiler. I have to write and run programs that read many input data
> > files and/or produce many output files. I am wondering if there is a
> > way, other than specifying the filenames in OPEN statements, to
> > establish a correspondence between the unit numbers and the filenames.
> > In Unix, it is possible to write scripts with SETENV statements
> > associating filenames to unit numbers. The FORTRAN program makes use
> > of the GETENV procedure to obtain the names.. I am wondering if
> > something similar exists for gfortran on a Windows system. If not,
> > what is the best way to provide the filenames to the program without a
> recompilation each time the filenames are changed ?
> I don't fortran but I see no reason why setenv and getenv shouldn't work for you on
> Windows since there are C equivalents that do the same thing.
> -- https://sites.google.com/site/earnieboyd
I use GFortran every day, on Windows Vista SP2.
GFortran does not support SETENV but it dos support both GETENV and GET_ENVIRONMENT_VARIABLE. GETENV is non-standard. GET_ENVIRONMENT_VARIABLE is standard Fortran starting with Fortran 2003. I strongly recommend that you use the standard intrinsic subroutine GET_ENVIRONMENT_VARIABLE.
Please feel free to contact me at any time with any questions or concerns that you may have.
Craig T. Dedo
17130 W. Burleigh Place
P. O. Box 423 Mobile Phone: (414) 412-5869
Brookfield, WI 53008-0423 E-mail: <craig@...>