This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Reading big-endian binary data on a little-endian machine
- From: Mark Panning <mpanning at seismo dot berkeley dot edu>
- To: gcc-help at gcc dot gnu dot org
- Date: Fri, 15 Aug 2003 12:34:23 -0700 (PDT)
- Subject: Reading big-endian binary data on a little-endian machine
- Reply-to: Mark Panning <mpanning at seismo dot berkeley dot edu>
I currently am in the process of trying to move some of my codes from a
Big-Endian Solaris system to a little-endian PC cluster running Linux. I would
however like to continue to use the binary data files I was using on the
Big-Endian system.
In ifc, a Fortran compiler, there is an environment variable F_UFMTENDIAN which
can be set such that all READ operations automatically perform a big-to-little
conversion and all WRITE operations perform the little-to-big covnersion.
Is there something similar which I can do with gcc or with options in the
read/write or fread/fwrite functions?
Mark Panning