Re: How to eliminate the bitmap difference in big endian and little endian?
- From: "Malcolm" <regniztar@xxxxxxxxxxxxxx>
- Date: Mon, 29 Aug 2005 19:03:59 +0000 (UTC)
"Eric J.Hu" <ehu@xxxxxxxxxx> wrote
> Such as I have following bitmap structure and assigned value
> The char value is 0x03 in little endian mode, and the char value is 0xc0
> in big endian mode. How > to eliminate the bitmap difference?
>
You shouldn't normally need to care about the endianness of your host
machine.
You do need to care about the endianness of binary format files.
Never read or write a structure directly to a file that needs to be ported.
Write the functions write16le(int x, FILE *fp) to write a 16-bit
little-endian integer to a file, and so on. Write each field individually.
That way the code works whatever happens to the C compiler's internal
structure layout.
.
- Prev by Date: Re: while (1) vs. for ( ;; )
- Next by Date: Re: Style isn't always religious
- Previous by thread: Re: How to eliminate the bitmap difference in big endian and little endian?
- Next by thread: Re: How to eliminate the bitmap difference in big endian and little endian?
- Index(es):
Relevant Pages
|