Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!rice!rice!sun-spots-request From: pln@sage0.gsfc.nasa.gov (Pat Nolan) Newsgroups: comp.sys.sun Subject: Reading variable-length records in Sun Fortran Keywords: Miscellaneous Message-ID: <1990Oct7.225430.950@rice.edu> Date: 7 Oct 90 21:30:00 GMT Sender: sun-spots-request@rice.edu Organization: Sun-Spots Lines: 15 Approved: Sun-Spots@rice.edu Originator: spots@walhalla.rice.edu X-Sun-Spots-Digest: Volume 9, Issue 334, message 7 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@SLACVM * * Hansen Laboratories * Internet: nolan@meggie.stanford.edu *