Замена STL / Boost для WideCharToMultiByte-функции

#c #boost

#c #повышение

Вопрос:

В следующем коде (фрагменте) WideCharToMultiByte приведена специфичная для Windows функция.

Есть ли подходящая замена функции с использованием STL или Boost?

 //in function parameters: (..., WCHAR* szNameOfDll, ...)

char szSourceTemp[MAX_PATH   1] = {0};

WideCharToMultiByte(CP_ACP,0,szNameOfDLL,-1, szSourceTemp,MAX_PATH,NULL,NULL);

  

Любая помощь приветствуется!

Комментарии:

1. std::wcstombs ?

Ответ №1:

 std::wctomb/std::wcstombs
std::mbtowc/std::mbstowcs
  

или

 #include <boost/locale.hpp>
#include <iostream>

std::string  utf8_string  = to_utf<char>(latin1_string,"Latin1");
std::wstring wide_string  = to_utf<wchar_t>(latin1_string,"Latin1");
std::string  latin1_string= from_utf(wide_string,"Latin1");
std::string  utf8_string2 = utf_to_utf<char>(wide_string);