quick C question
Originally posted by mingster
does anyone know how you convert strings to integers and vice versa in C?
does anyone know how you convert strings to integers and vice versa in C?
sprintf(char*, "%d", int*);
(or something) This is from memory and it's been a while.
For that one step or permanently - for the one step it would be something like this
to add character 'a' (var name char) and integer 3 (var name three) into integer variable var it would be
var = int(char) + int(three)
to add character 'a' (var name char) and integer 3 (var name three) into integer variable var it would be
var = int(char) + int(three)
Please post exactly what you want to convert (or an example there of) and I'll be happy to help out... atoi and itoa and sscanf are easy solutions... There are many others depending on your needs... I'll provide an example based on your sample.
-- Aaron
-- Aaron
Thread
Thread Starter
Forum
Replies
Last Post




