Ask a Question
Advertise on boostr.in
Organizational Research By
Surprising Reserch Topic
extracting the 4 byte of char from char string and convert the first 4 byte to i
extracting the 4 byte of char from char string and convert the first 4 byte to i ¬†using -'c'
I have a char array as string as char *x = "1234 is a test";
here 1234 the first 4 byte is a hex data and i need to extract the data and convert to the interger. Thus first I need to extract the first 4 byte as
now how can i convert this 4 byte char to int and convert to the integer value??
is it possible???
i have tried using strtol(dest, &ptr,16 );
however strtol finds the numerical values and seperates but i need the exact first 4 byte to convert to integer
what i suppose is the data is obtained from network thus without using strtol, I suppose to use hex to decimal conversion. Thus i need to first pack 4 bytes in int type and use this . How to coalesced this 4 byte of char to int??
Sep 9, 2015
to add a comment.
Related Hot Questions
Government Jobs Opening