Jump to content
  • Advertisement

Archived

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

hello_there

sprintf question

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

you know how sprintf(numbers, " %0.17f", somenumber); converts it so you can print it useing a char. can you do it the other way and convert letters to numbers?

Share this post


Link to post
Share on other sites
Advertisement
sprintf only changes char arrays, so no.
you''re looking for itoa().

int tempint;
itoa(tempint, string, base); // where base is 8, 10, or 16

-eldee
;another space monkey;
[ Forced Evolution Studios ]


::evolve::

Do NOT let Dr. Mario touch your genitals. He is not a real doctor!

Share this post


Link to post
Share on other sites
Actually I think the function you are looking for is atoi, not itoa. itoa converts an int to a char, atoi converts a char to an int, which is what I believe you are looking for.

- Dan
He who laughs, lasts

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!