作者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