It is currently Tue, 07 Dec 2021 02:26:27 GMT



 
Author Message
 Translating Sun short binary to linux short binary?
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);

but the values are incorrect. Does anyone have a mapping between Sun
binary
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



 Mon, 29 Jan 2001 03:00:00 GMT   
 Translating Sun short binary to linux short binary?
: 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

--
--------------------------------------------------
Victor Wagner                   vi...@ice.ru
Programmer                      Office:7-(095)-333-2022
Institute for Commerce          Home: 7-(095)-135-46-61
Engineering                     http://www.ice.ru/~vitus



 Fri, 02 Feb 2001 03:00:00 GMT   
 Translating Sun short binary to linux short binary?

I think that Sun is a big-endian while the PC intel is a
little-endian, meaning that the byte order is reverse. have ypu tried
to reverse the byte order ?

-----------------------------------------------------------------------
PHAM Dinh Tuan                         | e-mail: Dinh-Tuan.P...@imag.fr
Laboratoire de Modelisation et Calcul  | Tel: +33 4 76 51 44 23
BP 53, 38041 Grenoble cedex (France)   | Fax: +33 4 76 63 12 63
-----------------------------------------------------------------------



 Sun, 11 Feb 2001 03:00:00 GMT   
 
   [ 3 post ] 

Similar Threads

1. What port # is for short accepting short messages?

2. Gothic Money, Short Contract, Sun Failover

3. Gothic Money, Short Contract, Sun Failover

4. binary linux distro for sun spacstation

5. SUN Binaries on Linux

6. HP/Sun binary data file on linux

7. Insightful Hints on Linux - short help on start up

8. LINUX: dsl-connection crashes after short time

9. One small area where Linux falls short

10. PCNFS 5.1 + Linux = short files


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software