By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,505 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,505 IT Pros & Developers. It's quick & easy.

converting binary data

P: n/a

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
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.