| yottaflop (7) | |||
Hi, how do I convert a character array to a numerical value for use in operations? Or the other way around? Typecasting like with
Doesn't seem to be working. It's giving me ASCII codes, I think. Thanks and good day, YottaFlop. | |||
|
|
|||
| jeffbmartinez (31) | |||
If I'm understanding you correctly, you're going to want to look at int atoi (const char* str).Usage:
Don't forget to consider the possibility that an overflow might occur. In other words, if the string representation of the number is too big to fit in an int variable, you might not get what you expect. | |||
|
|
|||
| yottaflop (7) | |
| Ah, facepalm! I can't believe I forgot about that! Thanks. :) | |
|
|
|