Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

puchur

converting CString to int

This topic is 5299 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
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.

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!