   Little endian to host?
  I was wondering if the sockets libraries (or any others) had a function to convert little endian to host that I overlooked (like ntohl)?  Or should I roll my own?[edited by - Puzzler183 on February 8, 2004 9:11:07 PM]
  you mean little endian to big endian byte ordering aka network order? O_o ;  Something like that only not. Little endian -> local machine order is what I''m looking for, but apparently it doesn''t exist (big endian -> local does, ntohl and its peers). ;  huh? there is ntoh*, and hton*? its ''network to host'' and ''host to network''. ;  OK, as if I''m not making myself clear, I understand what htonl and ntohl do. I''m not a moron. Thye don''t do what I need though. They do local machine <==> network (big endian).  I want local machine <==> little endian.  Anyway, screw it, I''ll just roll my own. ;  Why does endianness matter, anyway? Can''t you just say "I''ll store things in network byte order and reverse it to host order on load?" ;  Probably for file format releated things (load and save from host to little endian file format).To answer the specific question, you''ll have to roll your own. I don''t think any of the standard libraries have this functionality.  ;  No standard functions can do it.  So you gotta write your own.I wonder why though.  Since the network (Big Endian) functionsare readily available, I expect most people would save binaryformats in Big Endian formats.  I do.   Kami no Itte ga ore ni zettai naru! ;  Pretty much any "standard" file format that originated on x86 is little endian. .3ds is a good example. All multi-byte values are stored in little endian form.;  I''m specifically concerned with Targa''s and BMP''s although I expect problems later with file formats as well. 