Valhalla Legends Forums Archive | General Programming | Character values in C++

AuthorMessageTime
TruffleShuffle
Whats the equiv. of chr() from VB, in C++ ?
May 7, 2003, 1:40 PM
Yoni
Just cast the number to a char, or simply assign it to a char.

The type char in C/C++ is actually an 8-bit integer. You may cast between different integer types freely.

Example:
[code]char escape = 27;
char fakespace = 160;[/code]
Etc...
May 7, 2003, 3:23 PM
iago
If you're using a string, don't forget to dereference it, though.
char *str = "iago is da bomb!";
char FirstLetter = *str;
-or-
char ThirdLetter = str[2];

May 8, 2003, 8:16 AM

Search