123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|660|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> C/C++/C#/Other -> Convert between Integer and ASCII

Wed, 11 Apr 2007, 20:00
blanko1324
For my latest project, I want to create 26 buttons, labeled A through Z, so that players can enter their name when they achieve a high score. This is not complicated by any means, but I'd like to keep the code as short as possible. So, I thought:



Obviously, this is not real code, but what it does is loop through 26 times (for every letter in the alphabet) and create a button with a one-character name from the ASCII value of i + 65, since the capital alphabet starts at 65 in ASCII.

Anyways, with all this pointless explanation aside, I've just got a tiny little question: What's the easiest way I can convert an interger into an ASCII character?


-=-=-
My Twitter
Wed, 11 Apr 2007, 20:27
mike_g
If its just one character then you can add 48 to it to turn it into its ascii code;

If the intger is several characters long then you could turn it into a string and go through each character getting the ascii code for it. I don't know if this is exactly what you want but here is an example I made: