: I have several large binary files written by SunOS4.1.3 as short ints.
: The files are read OK by linux using :
: fread ( (char *) &bm[t][a][b][c][d],2,1,fp);
If there are only short int, library function swab should help you.
If there are longs and, especially doubles, things might be more
complicated
: but the values are incorrect. Does anyone have a mapping between Sun
: binary
Mapping (both ways is)
short int a=(signed short)((unsigned short a)>>8 |a<<8);
ie 0x1234->0x3412 and vice versa.
Same for long
0x12345678 -> 0x78563412
split number into bytes and put these bytes in reverse order
: and i386 binary so that I can translate the files for linux? My
: observations of the
: differences using od -tdS leave me confused.
: Thanks,
: Harlan
--
--------------------------------------------------
Programmer Office:7-(095)-333-2022
Institute for Commerce Home: 7-(095)-135-46-61
Engineering http://www.ice.ru/~vitus