Help Files: Fortran77: Random IO





     HELP                      Sep. 15, 1984             F77/IO_RANDOM



                             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:

             open(10, file='randfile', form='unformatted',
            .        access='direct', recl=20 )

     Write to it by:

             real vec(5)
                ...
             write(10, rec=n) vec

     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.

             


Comments to decf@euler.berkeley.edu
© 1998 UC Regents