Dave's Brain

Browse - Programming Tips - How can I convert a string holding a hex number to an int?

Date: 2012jun18
Language: C/C++
Keywords: hexadecimal

Q.  How can I convert a string holding a hex number to an int?

A.

int number = strtol(str, NULL, 16);

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.