Jump to content
  • Advertisement

Archived

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

asdasd12345

converting an int to a char

This topic is 5192 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 have a score that i want to be able to convert to a char array so i can read through it one by one to see which bitmap to put on the screen. does anyone know how to do this?

Share this post


Link to post
Share on other sites
Advertisement
quote:
Original post by Mithoric
char buff[10];
itoa ( score,buff,10 );

Two problems: 1) itoa() is a non-standard function. 2) the buffer you allocated is inadequate, if the integer value is 1,000,000,000 or greater, the terminating null will smash the stack.

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!