Re: Short records on unformatted reads
- From: Thomas Koenig <Thomas.Koenig@xxxxxxxxx>
- Date: Mon, 30 Oct 2006 07:06:22 +0100 (CET)
Richard Maine <nospam@xxxxxxxxxxxxx> wrote:
program main
implicit none
integer, dimension(2) :: ia
open(10, form="unformatted", status="unknown")
write (10) 1, 'a'
rewind 10
ia = 42
read (10, err=20) ia
20 continue
print '(2I8)', ia
end program main
It is an illegal program, so the processor can do anything. You wrote an
integar and a character to the file. You then read two integers. That's
not legal (and is not likely to happen to work).
Thanks!
Note that the standard does not define I/O error conditions.
Yes, I had forgotten to take that into account...
Even if the err= exit is taken, the ia array becomes undefined in
standard speak.
If I replace the line
read (10, err=20) ia
with
read (10, err=20) ia(1), ia(2)
or
read (10, err=20) (ia(i),i=1,2)
(and add integer::i as appropriate above)
then I would expect ia(1) to be defined, though.
.
- Follow-Ups:
- Re: Short records on unformatted reads
- From: glen herrmannsfeldt
- Re: Short records on unformatted reads
- From: Richard Maine
- Re: Short records on unformatted reads
- References:
- Short records on unformatted reads
- From: Thomas Koenig
- Re: Short records on unformatted reads
- From: Richard Maine
- Short records on unformatted reads
- Prev by Date: Re: Online F77 information...
- Next by Date: Re: Online F77 information...
- Previous by thread: Re: Short records on unformatted reads
- Next by thread: Re: Short records on unformatted reads
- Index(es):