执行程序时的Fortran77参数 [英] Fortran77 parameter when executing program
问题描述
我目前正在执行Fortran77作业,所以请不要告诉我确切的编码,但是请给我一些提示:
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:
使用UNIX终端,我想通过执行来传递参数
Using UNIX terminal, I would like to get the parameter passed on by executing
./program.exe parameter
推荐答案
在标准Fortran77中,您不能这样做.故事结局.直到Fortran 2003才开始使用fortran程序访问命令行参数.
In standard Fortran77 you can't. End of story. Accessing command line arguments with fortran programs wasn't standardized until Fortran 2003.
如果您使用的是GNU fortran编译器,则可以使用 iargc()
和 getarg(i, arg)
函数,它们返回参数的数量和特定参数的值.
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.
这篇关于执行程序时的Fortran77参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!