fortran - gfortran 从 txt 文件读取时产生错误
问题描述
我是 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
请你帮助我好吗?十分感谢。
解决方案
推荐阅读
- google-apps-script - 如何使用自定义函数 ExtractAllRegex() 作为数组公式?[谷歌表格]
- python - 如何在时间日期之后对我的数据框进行排序?为什么它是那种磨损的?
- c++11 - 如何使用唯一指针创建矩阵?
- linux - 查找名称相似但日期不同的 linux 文件
- javascript - 如何编写“延迟”的苗条组件?
- security - red5 服务器的安全标头(开源) - 无嗅探、XSS 保护等
- sql - 使用 () OVER 或 HAVING 子句获取每月计数汇总
- amazon-web-services - AWS ECS Spring Boot 共享列表
微服务实例之间 - html - CSS将孩子增长到父母的最大宽度
- arduino - 我怎样才能在串行监视器上只打印一次