Binary files on 4D machines

John D. McCalpin mccalpin at perelandra.cms.udel.edu
Thu Aug 16 11:22:49 AEST 1990


>>>>> On 15 Aug 90 19:31:14 GMT, blbates at AERO4.LARC.NASA.GOV ("Brent L. Bates AAD/TAB MS361 x42854") said:

"Brent>    Does anyone know if SGI plans on FIXING their FORTRAN, so that
"Brent> we can write true binary files, the way we can on the 3000's.

It ain't broke, so it don't need to be fixed....

The FORTRAN standard does not specify the inner details of a file 
opened with form=unformatted, so vendors are free to do what they
wish.  In this case, SGI (following MIPS, I suppose) decided to
implement what is called a "control-word delimited" file in CDC-land.
Each record in a sequential, unformatted file is preceded and followed
by a 32-bit integer containing the number of bytes in the record.

Three things to keep in mind:
(1) This format is actually very convenient, since it is identical
    to the format used by Sun for sequential unformatted files.
(2) You can get rid of the control words by writing a direct-access
    file instead of a sequential one.  Of course, then the compiler
    expects the records to all be of the same length.
(3) C is often faster for low-level binary I/O, and can be linked
    with the FORTRAN fairly easily.
--
John D. McCalpin			mccalpin at perelandra.cms.udel.edu
Assistant Professor			mccalpin at vax1.udel.edu
College of Marine Studies, U. Del.	J.MCCALPIN/OMNET



More information about the Comp.sys.sgi mailing list