|
-
Jan 3rd, 2001, 04:37 PM
#1
Thread Starter
Member
How do you convert letters to ascii characters you know,
like 'A' to 45 and stuff like that?
Wisdom is supreme, therefore get wisdom,
though it costs all you have, get understanding.
Proverbs 4:7
-
Jan 3rd, 2001, 04:43 PM
#2
Monday Morning Lunatic
Code:
char a = 'A';
int code = (int)a;
Just cast to an integer - in C, all characters are numbers anyway
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Jan 4th, 2001, 10:32 AM
#3
Thread Starter
Member
Great
It worked, great, thanks, but how do you convert it back? would it be:
int a = '45';
char letter = (char)a;
???
Wisdom is supreme, therefore get wisdom,
though it costs all you have, get understanding.
Proverbs 4:7
-
Jan 4th, 2001, 01:22 PM
#4
Monday Morning Lunatic
Nearly:
Code:
int a = 45; /* no quotes */
char letter = (char)a;
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|