I'm using Turbo C++ v3 and I want to convert a string which contains hexadecimal numbers into a decimal integer. How do I do that?
Recommended Answers
Jump to PostJust call sscanf() to convert the string, like this
int main() { char text[] = "0x1C"; int x = 0; sscanf(text,"%x", &x); printf("%d\n", x); }
All 2 Replies
Be a part of the DaniWeb community
We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.