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?
jeevsmyd
-2
Junior Poster
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
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.