Re: io-unit has been opened
- From: baf <baf@xxxxxxxxxxx>
- Date: Sun, 29 Oct 2006 04:09:42 GMT
Brooks Moses wrote:
Mike wrote:I would like to know whether a file with io-unit has been opened.
To prevent from the following situation:
program main
open(11,file='a.dat',....
call suba()
close(11)
end
subroutine suba()
open(11,file='a.dat',....
......
close(11)
end subroutine suba
Can I detect if io-unit in suba has been used in somewhere else, like
main?
You've actually got two "errors" [1] going on there -- first, you're opening the same io-unit twice, and second, you're opening the same file twice (which is illegal).
If it is "illegal" to open the same file twice, then the Intel Fortran compiler has a bug. One of my student's wrote a program that opened the same file using two different unit numbers on successive statements. The file position "cursor" associated with each unit number operated independently of one another, much like record sets from two database queries. Very strange, but it worked! He could read the file completely through with one unit number and then again with the other without doing a rewind first.
.
- Follow-Ups:
- Re: io-unit has been opened
- From: Richard Maine
- Re: io-unit has been opened
- From: Gary Scott
- Re: io-unit has been opened
- References:
- io-unit has been opened
- From: Mike
- Re: io-unit has been opened
- From: Brooks Moses
- io-unit has been opened
- Prev by Date: Re: Why these original FORTRAN quirks?
- Next by Date: Re: Keywords: UPCASE, downcase or Capitalized?
- Previous by thread: Re: io-unit has been opened
- Next by thread: Re: io-unit has been opened
- Index(es):
Relevant Pages
|
|