Quantcast
Channel: Intel® Fortran Compiler
Viewing all articles
Browse latest Browse all 3270

Recursive I/O operation issue when calling inquire

$
0
0

I encounter an issue when calling "inquire" statement on one file and reading another one. Here is an example :

program test
  implicit none
  character(100)        :: fdata, fresult, dummy
  integer               :: uin, uout
  logical               :: i_opened

  fdata = "datatest.dat"
  fresult = "resultest.dat"

  open (newunit = uin, file = fdata, form='formatted', status = 'old')
  inquire(FILE=fresult, OPENED=I_OPENED, NUMBER = uout)

  read(uin,*) dummy
endprogram test

When I run that program, there is the following error :
severe (40): recursive I/O operation, unit -129 file unknown

This problem can be solved by placing the "inquire" statement before opening the fdata file, but i don't understand why. Can anyone explain this to me ?


Viewing all articles
Browse latest Browse all 3270

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>