先转成0X的字符串
std::string string_to_hex(const std::string& str) //transfer string to hex-string
{
std::string result = "0X";
std::string tmp;
stringstream ss;
for (int i = 0; i < str.size(); i++)
{
ss << hex << int(str[i]) << endl;
ss >> tmp;
result += tmp;
}
return result;
}
再将0XFFFF等转成longlong类型即可
long long result = strtoll(type.at(1).c_str(), NULL, 16);