[ee122] Network byte ordering functions...

Daniel Killebrew dank at eecs.berkeley.edu
Tue Nov 20 00:28:38 PST 2007

Anthony Kilman wrote:
> Quick question..
> Is there such a thing as htonc() [host to network (8-bit)char]? 
No, most machines order the bits within a byte the same way, it's the 
bytes within a 16bit or 32 bit word that can be ordered differently.
> If not,
> what is the easiest way to determine the "endian-ness" of the machine?
If you know the processor, google. If you have access to the source of 
the C standard library, you could look at the source for htons(). Or 
write a 32 bit word to memory, then read the memory locations out a byte 
at a time and see what order you get them in.

> Thanks in advance.
> Anthony
> _______________________________________________
> ee122 mailing list
> ee122 at mailman.ICSI.Berkeley.EDU
> http://mailman.ICSI.Berkeley.EDU/mailman/listinfo/ee122

More information about the ee122 mailing list