Looking to convert char Num[5] into an integer, is there such a way?
And if not, is there a way to start off with a string-ish type variable (to read from a textbox) and end up with an integer (for mathematical calculations)?
Thanks
Looking to convert char Num[5] into an integer, is there such a way?
And if not, is there a way to start off with a string-ish type variable (to read from a textbox) and end up with an integer (for mathematical calculations)?
Thanks
Look up sscanf and atoi.
Naturally I didn't feel inspired enough to read all the links for you, since I already slaved away for long hours under a blistering sun pressing the search button after typing four whole words! - Quzah
You. Fetch me my copy of the Wall Street Journal. You two, fight to the death - Stewie
It's similar to the method described in the FAQ. Just use the char arrays instead of strings.
As what you ask is more commonly used in C, read this FAQ entry. strtol() is the "safest" way.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]