|
-
Oct 12th, 2006, 05:31 PM
#1
Thread Starter
Fanatic Member
Finding ASCII code
I have a char variable with the character 'a' in it. How can i find the ASCII value of this?
p.s. I know its the ASCII value of 'a', but i need to use my program to find it.
Last edited by x-ice; Oct 12th, 2006 at 07:18 PM.
-
Oct 12th, 2006, 06:09 PM
#2
Re: Finding ASCII code
In C/C++, you can simply cast a char to an int in order to see it's character code.
Code:
char c = 'a';
cout << "the code for " << c << " is: " << (int)c << endl;
Hope this helps.
Every passing hour brings the Solar System forty-three thousand miles closer to Globular Cluster M13 in Hercules -- and still there are some misfits who insist that there is no such thing as progress.
-
Oct 12th, 2006, 07:18 PM
#3
Thread Starter
Fanatic Member
Re: Finding ASCII code
 Originally Posted by sunburnt
In C/C++, you can simply cast a char to an int in order to see it's character code.
Code:
char c = 'a';
cout << "the code for " << c << " is: " << (int)c << endl;
Hope this helps.
That helps, thanks.
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
|