作者HULK10425 (菩提王子)
看板Fortran
标题[问题] 出现看不懂的error
时间Sat Feb 4 12:01:01 2012
program main
implicit none
integer, parameter::a=10,b=20
integer c
integer count
character, allocatable::o(:)
character*200 d
integer e
integer error
integer i
open(a,file="call_price.txt",status="old")
count = 0
do while(.true.)
read(a,"(A200)",iostat=c)d
if(c/=0) exit
count=count+1
e=count
end do
write(*,*)count
allocate(o(e))
open(a,file="call_price.txt")
do i=1, e
read(*,*)o(i)
end do
stop
end
执行以後会出现
Error 84,only blank may be changed for a file that exists for a given program
想请教各位大师们,这是出现了甚麽问题呢? 感谢。ORZ
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.116.1.134
1F:→ HULK10425:我这个程式是想要把资料写到一个阵列里面! 02/04 12:02
2F:→ HULK10425:可是一直写不进去。 02/04 12:02
3F:→ Cypresslin:你的档案没有必要打开两次,要的话也要先关掉第一次的 02/04 12:09
4F:→ Cypresslin:可以用rewind(a)来将读取位置归位 02/04 12:10
5F:→ Cypresslin:另外恕我直言,您的排版改一下会让阅读更方便 02/04 12:11
6F:→ HULK10425:好的,我会改一下排版的。 02/04 12:24
7F:→ HULK10425:!!!您太神了,加了close以後就可以执行了。 02/04 12:26
8F:→ HULK10425:非常感谢 ^^ 02/04 12:26