Using macro functions such as a2w and a2t is a common method, but Chinese characters are garbled, so multibytetowidechar is used for conversion.
// Calculates the size of the char * array, in bytes. One Chinese Character occupies two bytes. Int Charlen = Strlen (stext ); // Calculate the size of Multi-byte characters by character. Int Len = multibytetowidechar (cp_acp, 0 , Stext, charlen, null, 0 ); // Applies for space for a wide byte character array. The array size is the size of Multi-byte characters calculated in bytes. Tchar * Buf =New Tchar [Len + 1 ]; // Convert multi-byte encoding to wide-byte encoding Multibytetowidechar (cp_acp, 0 , Stext, charlen, Buf, Len); Buf [Len] = ' \ 0 ' ; // Add the end of the string. Note that it is not Len + 1. // Convert a tchar array to a cstring Cstring pwidechar; pwidechar. append (BUF ); // Delete a buffer Delete [] Buf;