我是Fortran的初学者,我正在尝试使用Eclipse在Fortran中编写一个简单的程序。这个想法是从一个.txt文件中读取两个整数,然后将它们的总和写入其他.txt文件并保存。这些代码已在Eclipse中编译并成功运行,但是当我运行其可执行文件时,会产生此错误:
At line 6 of file ../Alo.f95 (unit = 11, file = 'SumData3.txt')
Fortran runtime error: End of file
Error termination. Backtrace:
#0 0x108c17579
#1 0x108c18235
#2 0x108c18999
#3 0x108ce001b
#4 0x108cdaa39
#5 0x108c10c73
#6 0x108c10e2a
logout
Saving session...
...copying shared history...
...saving history...truncating history files...
...completed.
这是我的密码
program test_random_number
implicit none
integer :: x,y,z
open(unit=11, file="SumData3.txt",status='old')
read(11,*) x,y
close(11)
z = x+y
open(unit=12, file="SumData4.txt")
write(12,*) "Summation =", z
close(12)
end
能帮我吗? 非常感谢。