Jump to content
  • Advertisement

Archived

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

O_Joe

converting string to integer

This topic is 5157 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

i needed to convert an integer into a string so that i could output its mirror image which i have done. I now need to convert the mirrored string into a integer so that i can see if the 2 are equal. i tried to use the atoi function however it keeps coming up with an error saying "cannot convert `str'' from type `string'' to type `const char *''" could anyone plz help me

Share this post


Link to post
Share on other sites
Advertisement
If you''re using std::string you can call str.c_str() where str is your variavle name to get it as a char* variable, then you can use it for atoi()

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!