我正在尝试从命令行将参数传递给 Fortran 可执行文件。在 C 中实现此目的的示例程序是(取自此处):
#include <stdio.h>
int main (int argc, char *argv[])
{
int count;
printf ("This program was called with \"%s\".\n",argv[0]);
if (argc > 1)
{
for (count = 1; count < argc; count++)
{
printf("argv[%d] = %s\n", count, argv[count]);
}
}
else
{
printf("The command had no other arguments.\n");
}
return 0;
}
这个程序的输出是:
This program was called with "./fubar".
argv[1] = a
argv[2] = b
argv[3] = c
我现在的问题是,我将如何在 Fortran 中编写这个程序(以及这个功能)?我用谷歌搜索了这个,似乎只有 Fortran 2003 具有将参数传递给可执行文件的功能(这是正确的)?