C++ convert hex string to signed integer
use std::stringstream unsigned int x; std::stringstream ss; ss << std::hex << “fffefffe”; ss >> x; the following example produces -65538 as its result: #include <sstream> #include <iostream> int main() { unsigned int x; std::stringstream ss; ss << std::hex << “fffefffe”; ss >> x; // output it as a signed type std::cout << static_cast<int>(x) << std::endl; … Read more