g77 has no facility for exchanging unformatted files with systems
using different number formats--even differing only in endianness (byte
order)--or written by other compilers. Some compilers provide
facilities at least for doing byte-swapping during unformatted I/O.
It is unrealistic to expect to cope with exchanging unformatted files
with arbitrary other compiler runtimes, but the
should at least be able to read files written by
g77 on systems
with different number formats, particularly if they differ only in byte
In case you do need to write a program to translate to or from
libf2c) unformatted files, they are written as
The record length is of C type
long; this means that it is 8 bytes on 64-bit systems such as
Alpha GNU/Linux and 4 bytes on other systems, such as x86 GNU/Linux.
Consequently such files cannot be exchanged between 64-bit and 32-bit
systems, even with the same basic number format.
) written and recl is the record length in bytes specified in the
). Data appear in the records as determined by the relevant
WRITEstatement. Dummy records with arbitrary contents appear in the file in place of records which haven't been written.
Thus for exchanging a sequential or direct access unformatted file
between big- and little-endian 32-bit systems using IEEE 754 floating
point it would be sufficient to reverse the bytes in consecutive words
in the file if, and only if, only
LOGICAL*4 data have been written to it by
If necessary, it is possible to do byte-oriented i/o with
FPUTC intrinsics. Byte-swapping can be done in
Fortran by equivalencing larger sized variables to an
array or a set of scalars.
If you need to exchange binary data between arbitrary system and
compiler variations, we recommend using a portable binary format with
Fortran bindings, such as NCSA's HDF (http://hdf.ncsa.uiuc.edu/)
or PACT's PDB1
say, CDF or XDR, HDF-like systems write in the native number formats and
only incur overhead when they are read on a system with a different
format.) A future
g77 runtime library should use such