What is the value of a unsigned long long in hex
I have this variable
unsigned long long latitude = 29.47667;
When I am converting this value to an array like this
ar[7] = (uint8_t)((latitude >> 56) & 0xFF);
ar[6] = (uint8_t)((latitude >> 48) & 0xFF);
ar[5] = (uint8_t)((latitude >> 40) & 0xFF);
ar[4] = (uint8_t)((latitude >> 32) & 0xFF);
ar[3] = (uint8_t)((latitude >> 24) & 0xFF);
ar[2] = (uint8_t)((latitude >> 16) & 0xFF);
ar[1] = (uint8_t)((latitude >> 8) & 0xFF);
ar[0] = (uint8_t)(latitude & 0xFF);
Then sending it to server using tcp socket. When I am sending I print the
values in hex, then I get 0x1d rest all zeros.
How to send the exact value to server while converting unsigned long long
to int.
No comments:
Post a Comment