[Fortran] 纯文本查看 复制代码
Program www_fcode_cn
Use, Intrinsic :: ISO_C_BINDING !// 使用内部模块,保持与 C 语言变量类型一致
Implicit None
character(len=4) :: flag0 !// 4字节
character(len=8) :: flag1 !// 8字节
character(len=4) :: dtype !// 数据类型
integer*4 :: i,j,k
integer*4 :: ii,jj,kk
Open( 12 , File = "INJECTWATER_FORWUNAN.GRID" , access="stream" , form = "unformatted" )
Read( 12 ) flag0,flag1,i,dtype
Write( * , * ) flag1,i,dtype
Read( 12 ) ii,jj,kk
Write( * , * ) ii,jj,kk
! Inquire( 12 , Pos = i )
! Write( * , * ) i
Close( 12 )
End Program www_fcode_cn
[Fortran] 纯文本查看 复制代码
Program www_fcode_cn
Implicit None
character(len=8) :: flag1 !// 8字节
character(len=4) :: dtype !// 数据类型
integer(kind=4) :: i,j,k,n
integer(kind=4) :: ii,jj,kk
Open( 12 , File = "INJECTWATER_FORWUNAN.GRID" ,convert='BIG_ENDIAN', access="stream" , form = "unformatted" )
Read( 12 ) n,flag1,i,dtype,n
Write( * , * ) flag1,i,dtype
Read( 12 ) n,ii,jj,kk,n
Write( * , * ) ii,jj,kk
Close( 12 )
End Program www_fcode_cn