c++ - how to change cstring to unicode -


i working in vc++ 6. , have cstring content. how change content unicode ? exmaple, have defined

cstring strname; 

strname have content in it(may chinese character in it).

and defined:

unicode* chinese_character; 

how transfer content of strname chinese_character?

note working in vc++ 6.

thanks.

after googling find useful function mbstowcs() used convert multibyte string wide-character string.

below example this.

{     wchar_t buf[255];     mbstowcs(buf,(const char*)name,name.getlength()+1);      byte bytes[255];     size_t length = wcslen(buf);     (size_t = 0; < length; i++)     {       bytes[i*2] = buf[i] >> 8;       bytes[i*2+1] = buf[i] & 0xff;     }   } 

Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -