For Programmers: Free Programming Magazines  


Home > Archive > Fortran > April 2005 > converting binary data









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author converting binary data
Dan Stromberg

2005-04-28, 4:01 am


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:
http://dcs.nac.uci.edu/~strombrg/converting-binary.html

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

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
records

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.

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com