3.11) Disconnecting An Input Or Output File From The Program
It is quite straightforward to disconnect, you just include the close statement(s)
in the program.
program example6 ! example of reading from the keyboard real :: a open(unit=22, file=’inputdata.dat’) open(unit=24, file=’outputdata.dat’) read (22,*) a write(24,*) a close(22) close(24) a=a+10. print *, a end program example6
This shows you how to close and detach files from the program.
Make sure you don’t try to use read(22,*)
or write(24,*)
after you have disconnected the files.