Solaris 5.8 - BinaryFile - Endianness

Thread Tools Search this Thread
Operating Systems Solaris Solaris 5.8 - BinaryFile - Endianness
# 8  
Old 09-02-2009
A binary hexadecimal editor is of no use with a structured binary file which I guess yours is.

That's not the whole file that you need to convert but only the various portions of potentially various size that are spread out at various locations.
# 9  
Old 09-02-2009
When I open/dump the Binary File on Solaris using "strings" command & "od" command and compare the dump with the same Binary File opened on Windows in a HEX Editor, I can see that the values are exactly at the same offset in both OSes.

Am I missing something while parsing (which I have not noticed yet) ?
# 10  
Old 09-02-2009
You are missing what endianness is about. It is absolutly expected a file content is the same regardless of the CPU architecture. What differs is how numerical values are interpreted.
# 11  
Old 09-03-2009
Thanks for the assistance.
While interpreting the numerical values in the parser code, the parser does something like this :-

1. Reads 2048 bytes and stores in a char* buffer.
2. Then, reads an "int" like this :
int count = *(buffer + 8);

So, to take care of the endianness, should I swap four bytes first i.e. swap based on the sizeof(datatype) and then assign the value to the variable ? Will this suffice for endian-ness ?
# 12  
Old 09-03-2009
That's the correct way.
# 13  
Old 09-04-2009
Thank You.
Now, if I do that way, then is it necessary to swap every BYTE (based on sizeof(datatype) ) ? Because, at some memory locations I am getting the expected numerical value directly (without swapping) and some values appear to be correct only after swapping. Is it correct ?
# 14  
Old 09-04-2009
This looks odd. It would help if you can have a look at the source code that wrote the data.
Login or Register to Ask a Question

Previous Thread | Next Thread

5 More Discussions You Might Find Interesting

1. AIX

IBM TDS/SDS (LDAP) - can I mix endianness among servers in an instance ?

I'd like to add some x/linux-based servers to my current AIX-based TDS/SDS server community. Reading the Fine Install Guide (rtfig ?) I believe this may be covered by the section "Upgrade an instance of a previous version to a different computer" i.e. I'm going to install latest/greatest SDS on a... (4 Replies)
Discussion started by: maraixadm
4 Replies

2. Solaris

How to add Solaris text console to Solaris grub2 menu?

Hi, I am new to sloaris and just instlled the solaris 11.2, i know little more about linux, i open the /boot/grub/grub.cfg in solaris and there is many other entries forl solaris 11.2 one of them is for 'Oracle Solaris 11.2 text console' but at boot grub2 only show the first default entry that... (1 Reply)
Discussion started by: shamsat
1 Replies

3. UNIX for Advanced & Expert Users

How to know endianness of a machine

hi I have a ubuntu machine and want to know the endianness of the system.... How would i get to know..... The information of my machine is: uname -a 42-Ubuntu SMP Mon Apr 11 03:31:50 UTC 201 1 i686 i686 i386 GNU/Linux and lsb_release -a No LSB modules are available.... (6 Replies)
Discussion started by: Ankita Singlaa
6 Replies

4. Solaris

Unable to login using ssh,telnet onto my solaris machine with solaris 10 installed

Hi, I am unable to login into my terminal hosting Solaris 10 and get the below error message "Server refused to allocate pty sh: fatal: open failed: No such file or directory " Is there anyways i can get into my machine and what kind of changes are required to be... (7 Replies)
Discussion started by: sankasu
7 Replies

5. Solaris

application compiled on solaris 10 throwing error when executed on solaris 9

I have compiled my application on Solaris 10 with following description SunOS ldg1 5.10 Generic_138888-03 sun4v sparc SUNW,Sun-Blade-T6320 The compiler is Sun C++ 5.9 SunOS_sparc Patch 124863-01 2007/07/25 But when installing the application on Solaris 9 SunOS odcarch02 5.9... (2 Replies)
Discussion started by: ash_bit2k2
2 Replies
Login or Register to Ask a Question