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.
Why not just use a library routine wcstombs.
wcstombs
1.4m articles
1.4m replys
5 comments
57.0k users