1. "recl=18627*9*4" 是不對的
2. 應該是 "recl=18627*4", for "write(12,rec=irec) (h(n,m),n=1,18627)", "real :: h(18627,9)", default REAL is4-byte
3. 這樣仍是"compiler dependent"
4. 請參考如下"compiler independent"的寫法
[Fortran] 纯文本查看 复制代码 PROGRAM test
IMPLICIT NONE
REAL:: h(18627,9)
INTEGER :: m, n, RecLength
!-------
m = 1
! Inquire the I/O Length of Unformatted Record in the Direct Access File
INQUIRE( IOLENGTH=RecLength ) (h(n,m),n=1,18627)
WRITE(*,*) RecLength ! 18672 for Intel/Compaq, 74508 for Absoft/Lahey/PGI/NAG/GNU/G95
!---> Value of "RecLength" is compiler dependent
!OPEN(UNIT=..., FILE=..., FORM='UNFORMATTED' ACCESS='DIRECT', RECL=RecLength)
END PROGRAM test |