I just found out that palm use "Big Endian" while PCs use "little Endian". 
Maybe this explains why I got some weird values when I do formated printing
using StrPrintF, eg., when I pass a UInt32 to a "%d".  Are there other concerns
about the byte orders in Palm programming?

One instance I can think of is when I work on file streams. If I have a file
stram that is an image of data file from a PC, I will runinto problem if I
expect a word to be read. I'll need to have the bytes converted.

FileRead(..., Int16 objSize, Int32 numObj, ...);

Now I have a question about the struct.  For example, I have the format:

typedef struct {
Int16 first;
Int32 second;
} MyStruct;

Is the first component stored at the low address or at high adress in Palm?

If I have the data of the struct written on PC to a file in one chunk with
fwrite: fwrite(..., sizeof(MyStruct), 1, ...);  

Then, I read the data from that FS on Palm with FileRead:
FileRead(..., sizeof(MyStruct), 1, ...);

What do I expect?  How do you guys deal with this sort of problems?

Thanks.

Max

__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com

-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/tech/support/forums/

Reply via email to