16,472
社区成员
发帖
与我相关
我的任务
分享
// 调用者请确保pHexOut有足够长度
void HexFormat(const char *pInput, int nNum, char* pHexOut)
{
pHexOut[0] = 0;
for(int i = 0; i < nNum; ++i)
{
sprintf(pHexOut + strlen(pHexOut), "%02X ", pInput[i]);
}
}
// 调用:
char mystr[10],
Receive[40];
HexFormat(mystr, 10, Receive);