我想将我的结果写入在递归子程序中生成的文件中。而且我还想将文件中的数据(读取)分配给我在fortran90中的主程序中的一个数组。
program permutations
implicit none
call generate (position_min)
open(unit=20, file="a.dat", status="old")
do i=1,720
read(20,*)(G(i,j),j=1,6)
end do
contains
recursive subroutine generate (position)
implicit none
integer, intent (in) :: position
integer :: value
if (position > position_max) then
open(unit=20, file="a.dat", status="unknown")
write (20, *) permutation
else
call generate(position+1)
end if
end subroutine generate
end program permutations
该程序给了我以下运行时错误。
At line 19 of file p2.f90 (unit = 20, file = 'a.dat')
Fortran runtime error: End of file
我该如何解决?