主题:[讨论]向各位fortran高手请教关于顺序读取二进制文件出错的问题
program test
implicit real*8 (a-h,o-z)
open(unit=1,file='./skwin',form='unformatted',status='replace')
do i=1,5
do j=1,4
rho=dfloat(j)
write(1) rho
end do
end do
close(1)
end program
program get
implicit real*8 (a-h,o-z)
real*8 rho(4)
open(unit=10,file='./skwin',form='unformatted',access='direct', &
& recl=8,status='old')
DO i=1,5
READ(unit=10,rec=i) (rho(j),j=1,4)
write(*,*) (rho(j),j=1,4)
END DO
CLOSE(10)
END Program
我用上面的test创建一个二进制文件,当用get顺序读取时得到的值跟test写进去的值不一样,请各位高手帮我分析一下