Reading variable-length records in Sun Fortran

Pat Nolan pln at sage0.gsfc.nasa.gov
Mon Oct 8 07:30:00 AEST 1990


Sun fortran (1.3.1) allows me to write variable-length unformatted records
on tape.  It attaches the recordlength to the record itself by adding a
4-byte integer both before and after the record.  (It's put after the
record to allow backspacing).  What I can't understand is how to read the
records if I don't know how long they're going to be.  As far as I can
tell, if the list of variables in an unformatted read doesn't exactly
match the length of the tape record, it's an error.  If I was doing
formatted I/O the Q format would help.  There doesn't seem to be an
equivalent for unformatted operations.

Am I missing something?  Am I going to have to write subroutines in C to
call open(2) and read(2), and handle the recordlength bytes by hand?

* Patrick Nolan              *  Bitnet: PLN at SLACVM                   *
* Hansen Laboratories        *  Internet: nolan at meggie.stanford.edu  *



More information about the Comp.sys.sun mailing list