This page describes some methods for converting binary data intended for one OS, compiler and/or CPU, to another.

  • This software is owned by The university of California, Irvine, and is not distributed under any version of the GPL. GPL is a fine series of licenses, but the owners of the software need it to be distributed under these terms.

    First off, if you want to future-proof your code, you should pick one of the following and use it:

    1. htons() and friends (mostly for network protocols)
    2. NetCDF (usually for scientific data you're writing to disk)
    3. If you're working with (Sun) RPC data, then XDR is your friend
    4. Plain old ASCII. If you think it's too wasteful of space and bandwidth, contemplate on XML for a while, then revisit ASCII. :)
    Any of these options are better, long term, than what I'm about to describe...

    But if you really do want the expedient route, then read on....

  • "Framed" fortran records
  • Options to change the byte order used by a language's runtime system
  • Converting specific formats
  • References


    1425

    Back to Dan's tech tidbits

    You can e-mail the author with questions or comments: