Manojg
- 47
- 0
Hi,
How can I pass command line argument in FORTRAN 77, like in C/C++?
Thanks.
How can I pass command line argument in FORTRAN 77, like in C/C++?
Thanks.
Passing command line arguments in FORTRAN 77 can be achieved using the Intel Fortran Compiler by utilizing the getarg function. Specifically, the syntax call getarg(1, buffer) allows the program to retrieve the first command line argument into the variable buffer. Subsequently, the read(buffer,*) variable statement assigns the value of the argument to the variable. This method enables users to execute the program with arguments, such as $ ./my_program abc, effectively setting variable to abc.
getarg functionFORTRAN developers, particularly those working with legacy code, and programmers transitioning from C/C++ to FORTRAN who need to understand command line argument handling.