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

javascript - Unusual behaviour when drawing lots of images onto a large canvas -

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

javascript - Chart.js - setting tooltip z-index -