void StringToByte(char* source, uint8_t* dest, int sourceLen) { int i; uint8_t highByte, lowByte; for (i = 0; i < sourceLen; i += 2) { highByte = toupper(source[i]); lowByte = toupper(source[i + 1]); if (highByte > 0x39) highByte -= 0x37; else highByte -= 0x30; if (lowByte > 0x39) lowByte -= 0x37; else lowByte -= 0x30; dest[i / 2] = (highByte << 4) | lowByte; } return ; }
标签:dest,StringToByte,uint8,source,int,highByte,lowByte From: https://www.cnblogs.com/yuqilihualuo/p/17296355.html