I want to convert Hex:390041 to ascii "90A",
39: 9
00: 0 -->Null
41: A
i am getting only "9" in the bytearray,i know 0 is terminating the array , could anybody tell me any alternate way .Please help me on this.
unsigned int bytes[3];
int j=0,counter=0;
char c[2];
unsigned char bytearray[4];
for(j=0;j<str.GetLength();j++)
{
if(0 == j%2)
{
c[0] = sSend[j];
c[1] = sSend[j+1];
sscanf(c, "%02x", &bytes[counter]);
bytearray[counter] =(unsigned char )bytes[counter];
counter++;
}
}
Last edited on