wchar_t to char[128]

T

those who know me have no need of my name

[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[128] 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

wchar_t to char[] 1
convert wint_t to wchar_t? 1
Using wchar_t instead of char 15
wchar_t is useless 18
char & wchar_t 5
wchar_t in Linux 41
3 questions on wchar_t 2
wchar_t to char 1

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top