Re: Endian issues...final chapter

Jerry Gaffke
 

We agree that  "Endianness is a problem when a binary file created on a computer is read on another computer with different endianness."

Where we seem to disagree is that I am convinced this code will always prints a value of "4"
regardless of whether the machine is big or little endian:

  long data32;    int  data8;
  data32 = 0x04030201;
  data8 = data32>>24;
  printf("%d \n", data8);

From this, we can create the endian agnostic code at the top of post 44018.  
Arv is correct, this is not something most of you need to worry about.
I'm totally done here.
Unless you want to talk about Gulliver's Travels.

Jerry


On Sat, Mar 10, 2018 at 08:42 am, Jack Purdum wrote:
   Endianness is a problem when a binary file created on a computer is read on another computer with different endianness.
 

Join BITX20@groups.io to automatically receive all group messages.