6 |
6 |
7 |
7 |
8 wchar_t* str2wstr(const char* str, int* newlen) { |
8 wchar_t* str2wstr(const char* str, int* newlen) { |
9 size_t len = strlen(str); |
9 size_t len = strlen(str); |
10 |
10 |
|
11 return str2wstr_len(str, len, newlen); |
|
12 } |
11 |
13 |
|
14 wchar_t* str2wstr_len(const char* str, size_t len, int* newlen) { |
12 wchar_t* wstr = (wchar_t*)calloc(len + 1, sizeof(wchar_t)); |
15 wchar_t* wstr = (wchar_t*)calloc(len + 1, sizeof(wchar_t)); |
13 int wlen = MultiByteToWideChar( |
16 int wlen = MultiByteToWideChar( |
14 CP_UTF8, |
17 CP_UTF8, |
15 0, |
18 0, |
16 str, |
19 str, |