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

Int to char array conversion - any suggestions

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

simple question here how can I convert: int Integer = 64; into char String[3] = "64"; Im trying to set up a stats shower for my game. I wrote a custom font engine which only accepts character arrays. I''ve tried it with numbers as its fields, so I know that that part of it will work. I just need to convert the integer that my fps function generates into a character array. thanks; Prairie

Share this post

Link to post
Share on other sites
Morbo is right... that will work...

Optionally, you could use itoa()...

itoa(Integer, String, 10);

that last parameter tells itoa what base to use... 2 for binary, 10 for decimal, 16 for hex, etc.

remember to include stdlib.h if you're gonna use it tho!


Edited by - Morkhai on July 18, 2000 12:40:13 PM

Share this post

Link to post
Share on other sites