Jump to content
  • Advertisement

Archived

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

Zeraan

Converting from integer value to character?

This topic is 5900 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''m working on this little message thing for my game, and I stumbled across my first obstacle. How do I convert int into char? I don''t want if/else like if i % 10 = 9 then c = ''9''. I want this: DrawMessage("SomeMessage"); DrawMessage(someIntVariable); Is this even possible? If so, then I want to do this also: DrawMessage("SomeMessage" + someIntVariable);

Share this post


Link to post
Share on other sites
Advertisement
Guest Anonymous Poster
Look up the ''sscanf()'' function or the ''stringstream'' class.

-D

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Pardon me. I meant the ''itoa()'' rather than ''sscanf()''.

-D

Share this post


Link to post
Share on other sites
quote:
none of those things should work, as they make char ARRAYS.


What making a string out of say 25 is bad? Do you have another way of doing it?

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!