Sun Studio 12: Fortran Programming Guide

2.6 Binary I/O Between Big-Endian and Little-Endian Platforms

A new compiler flag -xfilebyteorder provides support for binary I/O files when moving between SPARC and x86 platforms. The flag identifies the byte-order and byte-alignment of unformatted I/O files.

For example,

-xfilebyteorder=little4:%all,big16:20

would specify that all files (except those opened as "SCRATCH") contain “little-endian” data aligned on 4-byte boundaries (for example 32-bit x86), except for Fortran unit 20, which is a 64-bit “big-endian” file (for example 64-bit SPARC).

For details, see the f95(1) man page or the Fortran User’s Guide.