奇怪的地方,打印多出一串,不知道哪来的.
奇怪的地方,打印多出一串,不知道哪来的.
用unsigned char才正常。
static void printHex(const char* msg,const unsigned char* addr, unsigned int netCmdSize)
{
cout << msg;
cout << "[";
const unsigned char* p_start = addr;
unsigned char* ch = (unsigned char*)p_start;
for (; ch - p_start < netCmdSize; ++ch)
{
printf("%02X", *ch);
}
cout << "]" <<endl;
}