char* tchar_to_utf8(const TCHAR* str) {
#ifdef _UNICODE
    int size = WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), NULL, 0, NULL, NULL);
    char* str8 = (char*) malloc(size+1);
    WideCharToMultiByte(CP_UTF8, 0, str, wcslen(str), str8, size, NULL, NULL);
    str8[size] = '\0';
    return str8;
#else
    return _strdup(str);
#endif
}

  

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-15
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-01-22
  • 2021-11-23
  • 2022-12-23
  • 2021-09-03
  • 2021-11-01
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案