小众知识

Fortran--“GETARG”返回命令及命令行参数
2015-06-04 16:48:10   来源:   评论:0 点击:

Fortran命令行启动怎么往主程序输入参数?使用“GETARG”返回命令及命令行参数

CALL GETARG(n,buffer[,status])
n
输入,整数,INTEGER(2)。
参数的位置,命令本身的值为0:
command arg1 arg2
0       1    2

buffer
输出,字符串,Character*(*)。
返回的参数或命令:
command arg1 arg2
0       1    2
CALL GETARG(1,arg)
则,arg="arg1"

status
输出,整数,INTEGER(2),可选。
返回完成状态,如果错误,返回“-1”;如果正常,返回参数字符串的长度。
如果输入的n值小于0,或者大于参数的个数,则报错!

http://gcc.gnu.org/onlinedocs/gfortran/IARGC.html#IARGC
http://gcc.gnu.org/onlinedocs/gfortran/GETARG.html
Fortran 2003 functions and subroutines: GET_COMMAND, GET_COMMAND_ARGUMENT, COMMAND_ARGUMENT_COUNT
8.113 IARGC — Get the number of command line arguments

Description:
IARGC returns the number of arguments passed on the command line when the containing program was invoked.
This intrinsic routine is provided for backwards compatibility with GNU Fortran 77. In new code, programmers should consider the use of the COMMAND_ARGUMENT_COUNT intrinsic defined by the Fortran 2003 standard.

Standard:
GNU extension
Class:
Function
Syntax:
RESULT = IARGC()
Arguments:
None.
Return value:
The number of command line arguments, type INTEGER(4).
Example:
See GETARG
See also:
GNU Fortran 77 compatibility subroutine: GETARG
Fortran 2003 functions and subroutines: GET_COMMAND, GET_COMMAND_ARGUMENT, COMMAND_ARGUMENT_COUNT

相关热词搜索:Fortran 参数

上一篇:Fortran命令行启动怎么往主程序输入参数
下一篇:IVF MSB8018: No outputs specified for item

分享到: 收藏
评论排行
最新发布