c++字符串转16进制
std::string fromStringToHex( std::string _szData )
{
char *pcTemp = (char *)calloc(1UL, _szData.size() * 3 + 1);
int iCurPos = 0;
if (NULL != pcTemp)
{
for (int i = 0; i < _szData.size(); ++i)
{
iCurPos += sprintf(pcTemp + iCurPos, "%02X ", (unsigned char)_szData[i]);
}
pcTemp[iCurPos] = 0;
}
std::string szRet = std::string(pcTemp);
free(pcTemp);
retrun szRet;
}