Fortran unformatted file conversion from Solaris to linux
I have a binary data file that was written on a 64-bit Solaris box, I believe, and I need to read it in on my linux box. I understand that my linux architecture is considered to be "little endian" while Solaris is "big endian", but I'm not sure what that really means. More importantly, I don't know if or how I can convert between the two. Any help or suggestions would be greatly appreciated.
"I understand that my linux architecture is considered to be "little endian" while Solaris is "big endian", but I'm not sure what that really means. "
Here are two explanations of what little endian and big endian mean.
The other thing that you need to know is the format of the fields in the records on the binary data file that was written on a 64-bit Solaris box. Is each field a two byte binary number, a four byte binary number, or what? Do you have any floating point numbers which is a whole different kettle of fish?
Once you know the format of the Solaris fields you can probably convert each field by using modulo arithmetic. Or, alternatively, you could use Google to find a Fortran endian conversion routine.
Be prepared. Create a LifeBoat CD.
Knowing the layout of the numbers is critical. Assuming that you're talking about floating point, you'll need to know the number of bits in the mantissa and the exponent and what format each of these uses. (Caveat: I'm awfully rusty at this; it's been years since I've needed to do anything like this.) Somewhere in the Solaris documentation there should be a description of the floating point number format. There should be one available for whatever language you're using on Linux as well. If you're talking integer data, that should be a lot simpler and all you would have to do is swap the byte ordering appropriately. (You might find that the "swab" option of "dd" does the trick in this case.) Using a perl script you should be able to extract the different pieces of the data and swap or otherwise massage them into the Linux format. I'd probably choose Perl for this only because my C is getting pretty rusty too.
|All times are GMT -5. The time now is 03:00 PM.|