converting CString to int
Hello!
I''ve got problem with converting CString into int
This code ->
CString age;
int iAge;
iAge=atoi((char *)(LPCTSTR)age);
works badly because for age=345 in iAge I get 3
always the first digit
Any ideas?
quote:Original post by BriTeg
sprintf((LPCTSTR)age, "%d", &iAge);
Did you try this? It doesn''t make any sense given the original poster''s question.
quote:Original post by BriTeg
Sorry, I haven''t had my morning coffee yet. That should be sscanf, not sprintf.
Ahhhhh, yes that makes much more sense!
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement