1

我收到错误消息:

错误 90 文件访问和属性不兼容

给我错误的代码如下:

  PARAMETER (NPT=250, NPR=9)
  IMPLICIT  REAL*8 (A-H,O-Z)
  CHARACTER*255 ARQDAT
  DIMENSION Z(NPT,NPT,NPR) 
  COMMON/CPROP/ TMIN,TMAX,DT,PMIN,PMAX,DP,VMIN,VMAX,DX,DX2,DY,DY2,Z
  REAL*4 RGAS        
!*     Read matrix
  OPEN(UNIT=10,FILE=ARQDAT,FORM='UNFORMATTED', ACCESS='DIRECT',RECL=1)
  READ(10) Z !this is the statement giving error ARQDAT is a binary file
  CLOSE(UNIT=10)

为什么或我应该做什么?

4

1 回答 1

4

You opened the file ACCESS='DIRECT' but are doing a sequential READ on it - this is not allowed. Often when people do ACCESS='DIRECT',RECL='1' they want to read a byte at a time, but you have to combine this with a REC= value in the READ statement. In modern Fortran there are other, better ways to do this (such as ACCESS='STREAM').

What compiler are you using and on what operating system?

于 2013-08-01T20:25:16.697 回答