Hi All, I want to change HEX String to Byte Array, but I can't get the expected result.
HEXStr ="A4505D0B0F6AEDAA";Code://Hex String char* HEXStr="A4505D0B0F6AEDAA"; unsigned char* tmpByte=malloc(9); for(int i=0; i<16; i++) { sscanf(HEXStr, "02X", &tmpByte[i]); HEXStr+2*sizeof(char); } //Change it to Hex char* backHex=malloc(17); for(int i =0; i<8; i++) { sprintf(backHex+2*i, "02X", tmpByte[i]); }
Result of backHEX="FF505D0B0F6AFFFF";



LinkBack URL
About LinkBacks


