Re: Reading big-endian binary data on a little-endian machine

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 






From: Mark Panning <mpanning@xxxxxxxxxxxxxxxxxxx>
Reply-To: Mark Panning <mpanning@xxxxxxxxxxxxxxxxxxx>
To: gcc-help@xxxxxxxxxxx
Subject: Reading big-endian binary data on a little-endian machine
Date: Fri, 15 Aug 2003 12:34:23 -0700 (PDT)

____________________________________________
Did you know that you could
earn money with Dot TK? It's
simple. Become an affiliate
today and promote Dot TK on
your website!

http://www.dot.tk/vc00804.html
____________________________________________



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



No C is just too low-level for that, but...


If you only write an array of integers (NO floats or strings) you might get away with it by writing your own read and write functions that convert them on the fly.

_________________________________________________________________
Help STOP SPAM with the new MSN 8 and get 2 months FREE* http://join.msn.com/?page=features/junkmail



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux