Solving Byte Endianness Issues

Unformatted data comprises words of a certain byte length (typically four); the order the bytes are written in each word varies according to the platform. This is know as byte endianness; architectures can be either big or little endian.

	Sparc = big-endian

Intel x86 and alpha = little-endian

If you are trying to use unformatted data on an architecture of one endianess that was written on an architecture of another endianness, you may need to byte-swap the data in each word. To help you do this, software is available under /usr/local/wordswap from Linux. Simply follow the instructions in the file /usr/local/wordswap/README_wordswap.

Note for IDL Users - you don't need to byte-swap data. A useful command in IDL is to add to `openr' commands when reading big-endian format is `byteorder,/swap_if_little_endian', e.g.


This will only byte swap the data if IDL is run on a machine which defaults to little-endian format, and so ensures that the data is always read as big-endian regardless of what machine you run IDL on.