(1)处的固定格式源中名称中的字符无效 [英] Invalid character in name at (1) with fixed-form source

查看:760
本文介绍了(1)处的固定格式源中名称中的字符无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Fortran 77程序中得到一个错误(1)中名称无效的字符。这是为什么?

I am getting an eror "Invalid character in name at (1)" in my Fortran 77 program. Why is this?

它在我的阅读声明中

      100 READ(S,*,END=200) LINE

但我不确定为什么

代码:

      PROGRAM Exercise
C
C PARAMETERS
C
      INTEGER UNUM
      PARAMETER (UNUM=15)
C
C LOCAL VARIABLES
C
      REAL LINES

C
C FUNCTION DECLARATIONS
C
      REAL NUMLIN
C
C COMMON VARIABLES
C

C
C DATA STATEMENTS
C


C MAIN PROGRAM MODULE
C

      OPEN(UNIT=UNUM, FILE = 'line.txt', STATUS='OLD')
      LINES=NUNMLIN(UNUM)

C
C Rewinding to the top of the file because the pointer is at the end
C of the file
C

      REWIND(UNUM)
      CLOSE(UNUM)

      CALL PROCES(UNUM,LINES)

      STOP
      END PROGRAM

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C SUBROUTINE PROCES
C
C dynamically allocates space
C

      SUBROUTINE PROCES(U,L)

CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC
C FUNCTIONS
C
C NUMLIN -  counts the number of lines, uses the fact that the file
C is already open and passes this information to the next subroutine
C
      REAL FUNCTION NUMLIN(S)
      REAL NUMLIN
      REAL S

      CHARACTER*256 LINE
      100 READ(S,*,END=200) LINE
      NUMLIN=NUMLIN+1
      GOTO 100
      200 CONTINUE

      RETURN
      END

错误:

Error:

NumberCountingExercise.for:90.7:

      100 READ(S,*,END=200) LINE                                        
       1
Error: Invalid character in name at (1)
NumberCountingExercise.for:93.7:

      200 CONTINUE                                                      
       1
Error: Invalid character in name at (1)
NumberCountingExercise.for:85.27:


推荐答案

100 200 是(从第7列开始的)在语句字段中,并被视为实体名称的一部分。名称必须以字母开头。

100 and 200 are (starting in column 7) in the statement field and are taken as being part of entities' names. A name must begin with a letter.

这篇关于(1)处的固定格式源中名称中的字符无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆