Skip to main content
GameDev.net gamedev.net
🔒 Locked

Converting from integer value to character?

Started by Zeraan Jul 27, 2002 at 2:16 AM 5 replies 250+ views
Original Post
Zeraan
Zeraan
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);
EvilCrap
EvilCrap
none of those things should work, as they make char ARRAYS.
Cahaan
Cahaan
Naaah use sprintf instead:

sprintf(yourchar,"%d",yourint);
Darkhaven Beta-test stage coming soon.
Monder
Monder
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?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.