|
|
BSD 4.3tahoe
.TI F77/IO_RANDOM "Sep. 15, 1984"
Random Access I/O
F77 allows files to be accessed by both sequential and direct (random)
access reads and writes.
For example, suppose you want
to use random access I/O on unit 10 with records that are 20 bytes
long.
Open unit 10 by:
.nf
open(10, file='randfile', form='unformatted',
. access='direct', recl=20 )
.fi
Write to it by:
.nf
real vec(5)
...
write(10, rec=n) vec
.fi
and read from it by:
read(10, rec=n) vec
where n contains the record number being read or written.
The f77 I/O library
keeps track of the highest record number written to the file.
Any time
a write specifies a higher record number, the file is extended.
If a
read specifies a higher record number, an end-of-file error results.
Records not explicitly written contain zeros.
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.