wchar_t to char
how do i convert wchar_t to char or vice versa
Re: wchar_t to char
[c and c++ are not the same langauge; my answer is for c (since you posted
to clc) so i'm not following your followup-to.]
in comp.lang.c i read:
>how do i convert wchar_t to char or vice versa
a single wide-character can be converted to a multi-byte character sequence
with the wctomb function.
if the wchar_t corresponds with a single char then wctob may be used, and
you may use it to determine if such is the case, though if you are prepared
for up to MB_CUR_MAX bytes of result you may as well just use wctomb.
to convert a multi-byte character sequence into a wide-character use mbtowc.
if you have string of multi-byte characters then look at mbstowcs, which
produces a wide-character string result.
each of these may fail so be sure to pay attention to the return value.
|All times are GMT. The time now is 02:23 AM.|
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.