Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Unable to close file

tjt
Beginner
513 Views
Hi,

Does anybody know any reason why it would be imnpossible to close a file?

Compiled using Intel Fortran 11.1 on Windows XP 64 bit.

I am a little bit stuck...



logical three_is_open



inquire(unit=3,OPENED=three_is_open)

print*,' checking 3'

if(three_is_open) then
print*,' three_is_open = ',three_is_open
close(3)
print*,' 3 is closed '
endif

print*,' checking 3 again'

if(three_is_open) then
print*,' three_is_open = ',three_is_open
close(3)
print*,' 3 is closed '
endif

call close_file_3()

print*,' checking 3 yet again'

if(three_is_open) then
print*,' three_is_open = ',three_is_open
close(3)
print*,' 3 is closed '
endif


c ---------------------------------------------------------------------
c ---------------------------------------------------------------------

subroutine close_file_3()

c ---------------------------------------------------------------------

close(3)

c ---------------------------------------------------------------------

return
end

Screen output:

checking 3
three_is_open = T
3 is closed
checking 3 again
three_is_open = T
3 is closed
checking 3 yet again
three_is_open = T
3 is closed


0 Kudos
1 Reply
Steven_L_Intel1
Employee
513 Views
Do you somehow expect the value of three_is_open to automatically change without doing another INQUIRE?
0 Kudos
Reply