#include <sstream>
#include <iostream>
int main() {
unsigned int x;
std::stringstream ss;
ss << std::hex << "FF";
ss >> x;
// output it as a signed type
std::cout << static_cast<int>(x) << std::endl;
}
Hex string convert to integer with stringstream
原文地址:http://www.cnblogs.com/lidabo/p/4012283.html