Fortran--“GETARG”返回命令及命令行参数 - 小众知识

Fortran--“GETARG”返回命令及命令行参数

2015-06-04 08:48:10 苏内容
  标签: Fortran/参数
阅读:6054

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

扩展阅读
相关阅读
© CopyRight 2010-2021, PREDREAM.ORG, Inc.All Rights Reserved. 京ICP备13045924号-1