Author Topic: Int To Char  (Read 1797 times)

Offline Spikerocks101

  • Hero Member
  • *****
  • Posts: 711
Int To Char
« on: February 08, 2010, 11:45:33 PM »
Ok, this is probably a dumb question, but how do I convert an int into a char[]? Here kinda what I want done:

//I have a int score
int score;
//I need something like char[]
char[20] myCharArray;
//I want it to have the words "Score: " in it then the score
myCharArray = "Score: " + score;
//then I output it to a function to render on the screen
render(myCharArray);

So in total, I want it to look like "Score: 35"

Any help?
I AM YOUR PET ROCK!!!!!!

Offline ray

  • Newbie
  • *
  • Posts: 13
Int To Char
« Reply #1 on: February 09, 2010, 08:19:32 AM »
use sprintf

Offline Spikerocks101

  • Hero Member
  • *****
  • Posts: 711
Int To Char
« Reply #2 on: February 09, 2010, 10:52:02 AM »
sometimes, i really wish i knew the simple stuff. thanks, it worked well. :D
I AM YOUR PET ROCK!!!!!!