472,099 Members | 2,529 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,099 software developers and data experts.

converting binary data

I've written up a page about how to convert native binary data to
another platform's native binary data, as I did some fortran data
conversions for a client.

The programs and documentation are at:

So far, the page includes a variety of programs written in C or python to

1) A program for determining if your machine is big endian, little endian,
or something else

2) A program for swapping big endian to little endian, or vice versa, on
words of an arbitrary number of bytes, assuming a homogeneous size for all
items in the file

3) A pair of programs for converting a series of reals/floats to ascii and
back again (to be used in combination with ssh, rsh, &c)

4) An example program that converts binary data with variable length

5) A program that removes fortran record framing for big endian or little
endian, with arbitrary word size (must bew a multiple of 8 bits)
The documentation includes:

1) A taxonomy of three different kinds of conversions

2) Tips for determining record lengths

3) An admonition to reject these methods, and instead convert to a
platform-independent representation. A list of common
platform-independent representations is given.
I hope someone will find this useful.

Jul 19 '05 #1
0 1818

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Joseph Suprenant | last post: by
5 posts views Thread by nickisme | last post: by
2 posts views Thread by Mariusz Sakowski | last post: by
reply views Thread by Dan Stromberg | last post: by
2 posts views Thread by LittlePython | last post: by
reply views Thread by leo001 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.