tags:

views:

50

answers:

2

Hello, I have a char variable, declared for example as:

char a = 's';

How can I get the ASCII code of this symbol?

Thank you.

+1  A: 

Use QChar? :) http://doc.trolltech.com/4.6/qchar.html

leinir
+4  A: 

a holds the ascii value of 's' (115). Think of a char as just a small integer. If you want it in an integer for whatever reason, just cast it.

char a = 's';
int code = a; //or (int)a;
Yacoby
Or `(int) a;` ?
voyager