0

I'm using a code snippet like the following (from this question):

char const hex_chars[16] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };

for( int i = data; i < data_length; ++i )
{
  char const byte = data[i];

  string += hex_chars[ ( byte & 0xF0 ) >> 4 ];
  string += hex_chars[ ( byte & 0x0F ) >> 0 ];
}

It works; however, it produces a string like F0000000 (for example).

Firstly, what endianness is this?

Secondly, how could I change the code to change the endianness of the output?

Thank you very much in advance.

JS1
  • 4,745
  • 1
  • 14
  • 19
traky
  • 21
  • 2

0 Answers0