
-----------------------------------
The_$hit
Wed May 11, 2005 7:31 pm

ASCII
-----------------------------------
how do you change a lettre into its ASCII value in C++?

-----------------------------------
1of42
Wed May 11, 2005 8:51 pm


-----------------------------------
I believe you can just cast it into an int, and vice versa.

-----------------------------------
wtd
Wed May 11, 2005 8:53 pm


-----------------------------------
char ch('t');
int i(static_cast(ch));

-----------------------------------
The_$hit
Thu May 19, 2005 6:49 pm


-----------------------------------
ok ty

i found you can do:


char a="a";
int blah=int(a);


-----------------------------------
wtd
Thu May 19, 2005 7:07 pm


-----------------------------------
ok ty

i found you can do:


char a="a";
int blah=int(a);


Character constants must be surrounded by single-quotes, not double-quotes.

Take advantage of implicit conversion and the C++ initialization syntax.

char a('a');
int blah(a);
