Fortran77 parameter during program execution
2 answers
In standard Fortran77, you can't. End of the story. Access to command line arguments with fortran programs was not standardized until Fortran 2003.
If you are using the GNU fortran compiler, you can reuse iargc()
and getarg(i, arg)
, which return the number of arguments and the value of a specific argument.
+3
source to share
In FORTRAN77, you can access command line arguments.
Below is the piece of code that I am using:
CHARACTER ARGV*10
N=IARGC()
CALL GETARG(1,ARGV)
Just do it. /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 converts ARGV to floating point integer.
+2
source to share