Translating Sun short binary to linux short binary?

Translating Sun short binary to linux short binary?

Post by Harlan Lefevr » Fri, 14 Aug 1998 04:00:00



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

 
 
 

Translating Sun short binary to linux short binary?

Post by vi.. » Tue, 18 Aug 1998 04:00:00


: 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

 
 
 

Translating Sun short binary to linux short binary?

Post by Dinh-Tuan Pha » Thu, 27 Aug 1998 04:00:00



> 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

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 ?

-----------------------------------------------------------------------

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
-----------------------------------------------------------------------

 
 
 

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

Hi,
  Just wondering if anyone knows what port number is used for sending
short messges (if there is one defined). I mean something like "net send
<username> <message>". I wanted to write a similar unix program to do
this. I do know a bit of socket programming. Anyone knows what port # is
'NT's net send' listening to? Thanks.

ch

2. Help! Can't get milo to start on a 164SX

3. Gothic Money, Short Contract, Sun Failover

4. Problem w printer & modem

5. finger & last bugs ?

6. "ELF binary type not known" when running a Linux binary??

7. dvieps

8. Short Summary of Linux vs. Win9X vs. Mac vs. ???

9. gcc binaries/expect binaries?

10. binary to binary

11. PCNFS 5.1 + Linux = short files

12. LINUX: dsl-connection crashes after short time