如何在OpenVMS Fortran中获取命令行参数? [英] How to get command line arguments in OpenVMS Fortran?

查看:71
本文介绍了如何在OpenVMS Fortran中获取命令行参数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要在fortran 90标准中实现C代码,并在出现下一个问题时停止.如何获取和使用命令行参数.我发现了

I need to realize c-code in fortran 90 standard and stopped on next problem. How get and use command line arguments. I found

GET_COMMAND_ARGUMENT

GET_COMMAND_ARGUMENT

getarg

getarg

但是在带fortran 90编译器的openvms系统中它不起作用.还有另一种在Fortran中获取命令行参数的方法吗?

But it doesn't work in the openvms system with fortran 90 compiler. There is another way to get command line arguments in Fortran?

C中的示例

   int main(int argc, char **argv)
{
  if (argc > 1)
....
}

示例(无效

ILINK-W-NUDFSYMS,2个未定义的符号:
%ILINK-I-UDFSYM,GETARG
%ILINK-I-UDFSYM,IARGC
%ILINK-W-USEUNDEF,未定义符号IARGC引用)

ILINK-W-NUDFSYMS, 2 undefined symbols:
%ILINK-I-UDFSYM, GETARG
%ILINK-I-UDFSYM, IARGC
%ILINK-W-USEUNDEF, undefined symbol IARGC referenced )

PROGRAM bulk1
    INTEGER :: i
    CHARACTER(len=32) :: arg

    DO i = 1, iargc()
    CALL getarg(i, arg)
    WRITE (*,*) arg
    END DO
END PROGRAM

推荐答案

如何访问程序命令行?"在任何与Fortran相关的常见问题上,它的功能可能都很重要.不幸的是,同样频繁的回答是取决于".直到包括Fortran 95在内,还没有标准的命令行访问方法.尽管F2003标准最终满足了这一要求,但可以合理地假设F2003编译器将在一段时间内不被普遍使用.同时,这使Fortran社区在未来几年内都面临着不一致的解决方案.

"How do I access the program command line?" is likely to feature high on any Fortran related FAQ. Unfortunately, the equally frequent answer is "It depends". Up to and including Fortran 95, there has been no standard method of command-line access. While the F2003 standard finally addresses this requirement, it is reasonable to assume that F2003 compilers will not be in general usage for some time. In the meantime, this leaves the Fortran community with its existing hotchpotch of inconsistent solutions for several years to come.

您可以使用此库 http://www.winteracter.com/f2kcli/index.htm

这篇关于如何在OpenVMS Fortran中获取命令行参数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆