Fortran Coder

查看: 6118|回复: 1
打印 上一主题 下一主题

[子程序] 程序编译错误 7938,求帮忙!

[复制链接]

6

帖子

4

主题

0

精华

入门

F 币
48 元
贡献
26 点
跳转到指定楼层
楼主
发表于 2019-5-28 20:25:47 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

以下是部分代码,红色部分提示错误:error #7938: Character length argument mismatch.   [DATAFL]
请问各位前辈哪里出现问题了呢?
还有一个疑惑:read(lin,'(a40)',err=98) datafl   这个read语句中各部分代表什么含义,这个代码在书上没找到类似的写法。。。。
如果有明白的,望不吝赐教。谢谢了。 问题如果有不清楚的地方,也请指出。。
      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

分享到:  微信微信
收藏收藏 点赞点赞 点踩点踩

954

帖子

0

主题

0

精华

大师

F 币
184 元
贡献
75 点

规矩勋章元老勋章新人勋章水王勋章热心勋章

QQ
沙发
发表于 2019-5-28 22:17:31 | 只看该作者
error #7938: Character length argument mismatch.   [DATAFL]
虚参的长度比实参DataFL的长度长。

read(lin,'(a40)',err=98) datafl
lin 读取的通道号(或内部文件字符串),看 lin 的定义
'(a40)' 读取格式,详见彭国伦的书,第四章第四节
err=98 ,遇到错误则 goto 98 执行。
您需要登录后才可以回帖 登录 | 极速注册

本版积分规则

捐赠本站|Archiver|关于我们 About Us|小黑屋|Fcode ( 京ICP备18005632-2号 )

GMT+8, 2024-4-26 21:45

Powered by Tencent X3.4

© 2013-2024 Tencent

快速回复 返回顶部 返回列表