byte-swap is a program that simple-mindedly attempts to byte swap all four byte quantities in a file. It pretty much will not work unless you are going from ABCD to DCBA order (or similar for other word sizes).

Please note that since the initial release of the program, I've added the ability to specify a word size with -w. So if you're on a machine with 11 byte words, you can swap ABCDEFGHIJK to KJIHGFEDCBA .

The program verifies that your file's length is a multiple of your selected wordsize, and attempts to give a progress report so you have a feel for how long the conversion is going to take (but only if the input is fstat()'able, which generally means files, but not pipes).

byte-swap is more likely to handle a file full of integers, than a file full of real's - but it can sometimes handle real's as well, or a file full of mixed-but-same-sized integers and reals, depending on what platforms are involved. If your file has character/string data in it, then byte-swap is likely to make a mess of that information.


Hits: 2800
Timestamp: 2024-12-26 21:57:34 PST

Back to Dan's tech tidbits

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