c - What is the value of a unsigned long long in hex -


i have variable

unsigned long long latitude = 29.47667; 

when converting value array 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 server using tcp socket. when sending print values in hex, 0x1d rest zeros.

how send exact value server while converting unsigned long long int.

unsigned long long latitude = 29.47667 doesn't make sense, unsigned long long integer type. variable gets truncated integer 29.

that's why 0x1d, 29 in hex.


Comments

Popular posts from this blog

java - How to Configure JAXRS and Spring With Annotations -

visual studio - TFS will not accept changes I've made to a Java project -

php - Create image in codeigniter on the fly -