[Fortran] 纯文本查看 复制代码 Program t
Implicit None
Real :: a(3)
Real :: b(3)
Character(10) :: cha
Integer :: ioerr
Open(11,file='in.txt',iostat=ioerr)
Open(12,file='out1.txt')
Do
Read(11,*) cha
If (cha(1:) == 'vector_a') Then
Write(*,*) cha
Read(11,*) a(:)
Write(12,*) 'a:', a(:)
Endif
If (cha(1:) == 'vector_b') Then
Write(*,*) cha
Read(11,*) b(:)
Write(12,*) 'b:', b(:)
Endif
If (ioerr/=0) Exit
Enddo
Close(11)
End Program t
出现如下报错 : ‘At line 10 of file testofcha00.f95 (unit = 11, file = 'in.txt')
Fortran runtime error: End of file’
不过程序的运行不出现错误,读入和写入都没问题。这个错误的出现会不会影响安全性什么的阿?
'in.txt'文件内容为:
vector_a
1.3 9.4 3.5
:end a
vector_b
2.9 7.8 3.3
:end b
|