I am currently doing a Fortran77 assignment, so please don't tell me the exact coding, but please give me a hint of what I want to do:
Using UNIX terminal, I would like to get the parameter passed on by executing
./program.exe parameter
I am currently doing a Fortran77 assignment, so please don't tell me the exact coding, but please give me a hint of what I want to do:
Using UNIX terminal, I would like to get the parameter passed on by executing
./program.exe parameter
In standard Fortran77 you can't. End of story. Accessing command line arguments with fortran programs wasn't standardized until Fortran 2003.
If you're using the GNU fortran compiler, you can use the iargc() and getarg(i, arg) functions, which return the number of arguments and the value of a specific argument, resepectively.
It is possible to access command line arguments in FORTRAN77.
Given below is the code fragment I use :
CHARACTER ARGV*10
N=IARGC()
CALL GETARG(1,ARGV)
Just do ./a.out 1 2 3
ARGV will store the value of the first argument, i.e, 1
To convert this argument to float, use
READ (ARGV,*) RARG
RARG will convert ARGV into a floating-point integer.