gfortran运行时错误:无法在Open语句

时间:2018-03-09 13:42:25

标签: fortran gfortran

我的程序中有一个使用status=replace的开放声明下面的代码示例:

do i=1,n
  open(11,file="energy.dat",status="replace")
  open(12,file="trajectory.dat",status="replace")
  do j=1,m
    ...
    write(11,*)energy
    write(12,*) x,y
    ...
  enddo
  close(11)
  close(12)
enddo

编译可以。当我运行它时,它会给出一个运行时错误:

  

Fortran运行时错误:无法在OPEN中更改STATUS参数   声明

enter image description here

这里有什么问题?

1 个答案:

答案 0 :(得分:0)

我知道这个问题,因为我在close(11)循环之后确实没有j正确。因此,公开声明无法改变状态。

相关问题