WideCharToMultiByte函数的STL /升压替换

问题描述

在下面的代码摘要)中,WideCharToMultiByte是Windows特定的功能

是否使用 STL Boost 替代了该功能

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

char szSourceTemp[MAX_PATH + 1] = {0};

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

任何帮助表示赞赏!

解决方法

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);

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...