Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!goya!turia.dit.upm.es!esink From: esink@turia.dit.upm.es Newsgroups: comp.lang.c Subject: Portability vs. Endianness Message-ID: <1991Mar12.105451.19488@dit.upm.es> Date: 12 Mar 91 10:54:51 GMT Sender: @dit.upm.es Reply-To: esink@turia.dit.upm.es () Organization: Dept. Ingenieria de Sistemas Telematicos, dit, upm, Madrid, Spain Lines: 36 Nntp-Posting-Host: turia.dit.upm.es OK. I read regularly, I check the FAQ List and other sources before posting ANYTHING. I even mail occasional simple questions directly to someone with authority so I don't flood the net with a possible FAQ. However, the 'policing' on this group at times approaches a neurotic level, so I proceed with caution. Forgive me if this has been discussed to death (FMITHBDTD) Given the following : long var; unsigned char Bytes[4]; Is there a portable way to move the value held in var into the memory space pointed to by Bytes, with the restriction that the representation be in Most Significant Byte first format ? I am well aware that sizeof(long) may not be 4. I want the value contained in var converted to a 68000 long word, and I want the code fragment to run on any machine. The solution must be ANSI C. Feel free to suggest your own declarations to replace or augment mine. Thanks in advance for the input, Eric Eric W. Sink | Putting the phrase |All opinions Departamento de Telematica | "Frequently Asked" |are mine and Universidad Politecnica de Madrid| in your kill file is |not necessarily esink@turia.dit.upm.es | not recommended. |yours.