主题:高分求助
woxiaowei123
[专家分:0] 发布于 2010-05-18 10:45:00
求有限元一子例行程序 分析中差这一子例行程序无法运行
SUBROUTINE getname(argv,nlen)
!
! This subroutine the base name of data file.
!
IMPLICIT NONE
INTEGER::narg
INTEGER,INTENT(OUT)::nlen
INTEGER::lnblnk,iargc
CHARACTER(*),INTENT(OUT)::argv
LOGICAL found
narg=iargc()
IF(narg.lt.1)THEN
WRITE(*,*)'Please enter the base name of data file: '
READ(*,*) argv
ELSE
[color=FF0000]CALL getarg(1,argv)[/color]
ENDIF
nlen=lnblnk(argv)
INQUIRE(file=argv(1:nlen)//'.dat',exist=found)
IF(.not.found)THEN
WRITE(*,*)'Data file not found: ',argv(1:nlen)//'.dat'
WRITE(*,*)'Please create or check spelling.'
STOP
ENDIF
RETURN
END SUBROUTINE getname
缺子例行程序 getarg(1,argv)
回复列表 (共2个回复)
沙发
asymptotic [专家分:16630] 发布于 2010-05-18 23:06:00
GETARG
Intrinsic Subroutine: Returns the specified command-line argument (where the command itself is argument number zero). This subroutine cannot be passed as an actual argument.
Syntax
CALL GETARG (n,buffer[,status])
n
(Input) Must be a scalar of type integer. This value is the position of the command-line argument to retrieve. The command itself is argument number 0.
buffer
(Output) Must be a scalar of type default character. Its value is the returned command-line argument.
status
(Output; optional) Must be a scalar of type integer. If specified, its value is the returned completion status.
If there were no errors, status returns the number of characters in the retrieved command-line argument before truncation or blank-padding. (That is, status is the original number of characters in the command-line argument.) Errors return a value of -1. Errors include specifying an argument position less than 0 or greater than the value returned by IARGC.
GETARG returns the nth command-line argument. If n is zero, the name of the executing program file is returned.
GETARG returns command-line arguments as they were entered. There is no case conversion.
If the command-line argument is shorter than buffer, GETARG pads buffer on the right with blanks. If the argument is longer than buffer, GETARG truncates the argument on the right. If there is an error, GETARG fills buffer with blanks.
Example
Assume a command-line invocation of PROG1 -g -c -a, and that buffer is at least five characters long. The following calls to GETARG return the corresponding arguments in buffer and status:
Statement
String returned in buffer
Length returned in status
CALL GETARG (0, buffer, status)
PROG1
5
CALL GETARG (1, buffer)
-g
undefined
CALL GETARG (2, buffer, status)
-c
2
CALL GETARG (3, buffer)
-a
undefined
CALL GETARG (4, buffer, status)
all blanks
-1
板凳
吃芒果中毒 [专家分:0] 发布于 2010-05-22 11:02:00
呵呵,这个我看了,还可以~~
我来回复