Skip to content

Instantly share code, notes, and snippets.

@DamonHao
Created August 6, 2014 09:29
Show Gist options
  • Select an option

  • Save DamonHao/49057ee439c82894d6ba to your computer and use it in GitHub Desktop.

Select an option

Save DamonHao/49057ee439c82894d6ba to your computer and use it in GitHub Desktop.
converting Hex string to unsigned long
#include <sstream>
#include <iostream>
int main()
{
std::string s("0xFFF000");
unsigned long value;
std::istringstream iss(s);
iss >> std::hex >> value;
std::cout << value << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment