ios - Convert some bytes from a unsigned char to int -


i want convert bytes int. code far:

unsigned char *byteptr = (unsigned char *)[ansdataframe]; 

i want take 4 bytes unsigned char: myframe[10], myframe[11], myframe[12] , myframe[13] , convert them integer.

int bytestoint(unsigned char* b, unsigned length) {      int val = 0;      int j = 0;      (int = length-1; >= 0; --i)     {         val += (b[i] & 0xff) << (8*j);         ++j;     }     return val; } 

Comments

Popular posts from this blog

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -