主题:以二进制格式存储并读出二进制复数的问题
写复数到二进制文件代码:
Program main
Implicit None
Open( 12 , File = 'TestBinW.Bin' , Access = 'Direct' , Form = 'Unformatted' , RecL = 4 )
Write( 12 , Rec = 1 ) cmplx(1.23456789D-7,9.87654321D-8)
Close( 12 )
End Program main
从二进制文件中读出复数的代码:
Program main
Implicit None
complex(8) :: rVar1
Open( 12 , File = 'TestBinW.Bin' , Access = 'Direct' , Form = 'Unformatted' , RecL = 4)
Read( 12 , Rec = 1 ) rVar1
Write( * , * ) rVar1
Close( 12 )
pause
End Program main
不知何故,读取后显示的结果不是(1.23456789D-7,9.87654321D-8) ,而是 (5.002596306003016E-59,0.000000000000000E+00) ,烦请各位老师指教!
Program main
Implicit None
Open( 12 , File = 'TestBinW.Bin' , Access = 'Direct' , Form = 'Unformatted' , RecL = 4 )
Write( 12 , Rec = 1 ) cmplx(1.23456789D-7,9.87654321D-8)
Close( 12 )
End Program main
从二进制文件中读出复数的代码:
Program main
Implicit None
complex(8) :: rVar1
Open( 12 , File = 'TestBinW.Bin' , Access = 'Direct' , Form = 'Unformatted' , RecL = 4)
Read( 12 , Rec = 1 ) rVar1
Write( * , * ) rVar1
Close( 12 )
pause
End Program main
不知何故,读取后显示的结果不是(1.23456789D-7,9.87654321D-8) ,而是 (5.002596306003016E-59,0.000000000000000E+00) ,烦请各位老师指教!