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
Printable View
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.
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.