Convert wchar_t to char
Posted
by Yan Cheng CHEOK
on Stack Overflow
See other posts from Stack Overflow
or by Yan Cheng CHEOK
Published on 2010-06-11T03:14:06Z
Indexed on
2010/06/11
3:23 UTC
Read the original article
Hit count: 272
c++
I was wondering is it safe to do so?
wchar_t wide = /* something */;
assert(wide >= 0 && wide < 256 &&);
char myChar = static_cast<char>(wide);
If I am pretty sure the wide char will fall within ASCII range.
© Stack Overflow or respective owner