#include <sstream> #include <iostream> #include <iomanip> using namespace std; int main() { unsigned int x; std::stringstream ss; ss << std::hex << "ffff"; ss >> x; // output it as a signed type std::cout << static_cast<int>(x) << std::endl; return 0; } /* OUTPUT: 65535 */