Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parsing Hexadecimal #90

Open
babbutycoon opened this issue Dec 12, 2019 · 1 comment
Open

parsing Hexadecimal #90

babbutycoon opened this issue Dec 12, 2019 · 1 comment

Comments

@babbutycoon
Copy link

How do I parse hexadecimal numbers?

@gghati
Copy link

gghati commented Dec 28, 2019

You can use stringstream class as shown below:

#include
#include

int main() {
unsigned int x;
std::stringstream ss;
ss << std::hex << "fffefffe";
ss >> x;
// output it as a signed type
std::cout << static_cast(x) << std::endl;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants