newunit Function

private function newunit() result(nu)

Helper function to provide new unit, as long as F2008 newunit argument in open statement is not commonly available.

To be used right in front of the open statement like this: myUnit = newunit() open(myUnit, ...)

Arguments

None

Return Value integer


Called by

proc~~newunit~~CalledByGraph proc~newunit newunit proc~aot_out_open aot_out_open proc~aot_out_open->proc~newunit

Source Code

  function newunit() result(nu)
    integer :: nu

    logical :: connected

    nu = 21
    inquire(unit=nu, opened=connected)
    do while(connected)
      nu = nu + 1
      inquire(unit=nu, opened=connected)
    end do
  end function newunit