Re: reading back a partially-written record on direct access
- From: glen herrmannsfeldt <gah@xxxxxxxxxxxxxxxx>
- Date: Sat, 31 Mar 2007 02:03:18 -0800
Thomas König wrote:
Is the following program standard-conforming?
PROGRAM test
IMPLICIT NONE
CHARACTER*8 as_written, as_read
INTEGER irec
INTEGER i
as_written = "12345678"
inquire (iolength=irec) as_written, i
OPEN (76, FILE="test.txt", ACCESS="DIRECT", STATUS="NEW",
& RECL=irec)
WRITE(76, REC=1) as_written
READ(76, REC=1) as_read, i
PRINT *, "as_written = ", as_written, " as_read = ", as_read
CLOSE(76)
END PROGRAM test
I don't think it is, because it reads something that wasn't written
(the variable i). On the other hand, i isn't used, so it may be OK.
9.5.3.4.1 "On output to a file connected for unformatted direct access,
the output list shall not specify more values than can fit
into the record. If the file is connected for direct access
and the values specified by the output list do not fill the
record, the remainder of the record is undefined."
The value of I is at least undefined.
-- glen
.
- Follow-Ups:
- Re: reading back a partially-written record on direct access
- From: Richard Maine
- Re: reading back a partially-written record on direct access
- References:
- reading back a partially-written record on direct access
- From: Thomas König
- reading back a partially-written record on direct access
- Prev by Date: Re: John Backus 1924-2007
- Next by Date: Re: Starting to doubt fortran
- Previous by thread: reading back a partially-written record on direct access
- Next by thread: Re: reading back a partially-written record on direct access
- Index(es):
Relevant Pages
|