Computing.Net > Forums > Programming > Endianess issues?

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Endianess issues?

Reply to Message Icon

Name: Leo the 28C (by Sulfurik)
Date: October 4, 2007 at 04:42:51 Pacific
OS: Ubuntu Linux
CPU/Ram: 3.2GHz/256MB
Product: Sony PlayStation 3
Comment:

Hello everyone!

Okay, my app here works fine under Windows and i386 Linux, however it won't work on my Linux PS3 which has a PowerPC processor.

Since it works on PC Linux, I bet it's an endianess issue. The problem is that I have a binary file that the app uses to load its data. Well, I read a single byte and it turns out to be zero instead of the expected 12.

All I do here is fgetc() for single bytes and fread() for strings, so I don't know how endianess applies here...

Any ideas? Thanks in advance!


If I connect my microwave to my PC, will I be able to download food? I posted a question, haha



Sponsored Link
Ads by Google

Response Number 1
Name: Guy
Date: October 5, 2007 at 14:11:05 Pacific
Reply:

Hard to tell if your problem is due to endian issues or not.

I'm not going to explain what big/little-endian is or the details of the issues involved. See:

http://developer.apple.com/document...

http://support.microsoft.com/kb/102025

http://www.webopedia.com/TERM/b/big...

for some information. Use google for more info.

The PowerPC is bi-endian. It can be switched from one mode to the other programatically.

But if you are reading a previously foreign formatted stream, you are going to have to do the conversion yourself, in your code.

If you really want to understand this you need to write a couple of Assembler programs, some on a little-endian box (Intel e.g.), some on a big-endian box (IBM mainframe e.g.).

Low level code should really support both/either. See the TIF file specification for example: if you process TIFs you must be able to handle either format.

So ..... how does your code use 'fgetc' to read e.g. a 4 byte 'int'??



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Programming Forum Home


Sponsored links

Ads by Google


Results for: Endianess issues?

Very intersting Date/Time format issue www.computing.net/answers/programming/very-intersting-datetime-format-issue/2359.html

C++, issues converting decimal to f www.computing.net/answers/programming/c-issues-converting-decimal-to-f/15401.html

winXP cookie issues www.computing.net/answers/programming/winxp-cookie-issues/12447.html