程序编译错误 7938,求帮忙!
以下是部分代码,红色部分提示错误:error #7938: Character length argument mismatch.
请问各位前辈哪里出现问题了呢?
还有一个疑惑:read(lin,'(a40)',err=98) datafl 这个read语句中各部分代表什么含义,这个代码在书上没找到类似的写法。。。。
如果有明白的,望不吝赐教。谢谢了。 问题如果有不清楚的地方,也请指出。。:-lol
include'sgsim.inc'
real var(50)
real*8 p,acorni,cp,oldcp,w
character(len=40) transfl,smthfl,tmpfl,datafl,outfl,
+ dbgfl,lvmfl,str
logical testfl
c
c Note VERSION number:
c
c write(*,9999) VERSION
c 9999 format(/' SGSIM Version: ',f5.3/)
c
c Get the name of the parameter file - try the default name if no input:
c
c write(*,*) 'Which parameter file do you want to use?'
c read (*,'(a40)') str
c if(str(1:1).eq.' ')str='pp-co2.par '
str='pp-co2.par'
c inquire(file=str,exist=testfl)
c if(.not.testfl) then
c write(*,*) 'ERROR - the parameter file does not exist,'
c write(*,*) ' check for the file and try again'
c write(*,*)
c if(str(1:20).eq.'pp-co2.par ') then
c write(*,*) ' creating a blank parameter file'
c call makepar
c write(*,*)
c end if
c stop
c endif
open(lin,file=str,status='OLD')
c
c Find Start of Parameters:
c
1 read(lin,'(a4)',end=98) str(1:4)
if(str(1:4).ne.'STAR') go to 1
c
c Read Input Parameters:
c
read(lin,'(a40)',err=98) datafl
call chknam(datafl,40)
c write(*,*) ' data file = ',datafl
error #7938: Character length argument mismatch.
虚参的长度比实参DataFL的长度长。
read(lin,'(a40)',err=98) datafl
lin 读取的通道号(或内部文件字符串),看 lin 的定义
'(a40)' 读取格式,详见彭国伦的书,第四章第四节
err=98 ,遇到错误则 goto 98 执行。
页:
[1]