Home > Back-end > For help on converting char * would * C
For help on converting char * would * C
Time:10-29
Code:
#include #include #include #include #include Int main () { The setlocale (LC_ALL, ""); Would be WSTR [100]. Char STR [100]. Strcpy (STR, "Chinese test"); Printf (" strlen: % I64d \ n ", strlen (STR)); Size_t len. Mbstowcs_s (& amp; Len, WSTR, 99, STR, strlen (STR)); If (len<=0) { Perror (" error "); } else { Wprintf (L "length: % ld, conversion: % ls \ n", len, WSTR); return 0; } }
Compile platform: win10 mingw - w64 Execution (compile) the code or error occurs, but if I add parameters at compile time - fexec - charset=GBK is normal, this is how to return a responsibility? I don't want to let the software limited to deal with Chinese