blob: 607735cf2f7ded55c68b9406a9f1597109726e98 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
#include "win32/stringutils.hpp"
using namespace std;
#define WIN32_MEAN_AND_LEAN
#include <windows.h>
std::wstring s2ws( const std::string &s )
{
// get size for buffer and allocate it
int len;
int slength = (int)s.length( )+1;
len = MultiByteToWideChar( CP_ACP, 0, s.c_str( ), slength, 0, 0 );
wchar_t *buf = new wchar_t[len];
// convert
MultiByteToWideChar( CP_ACP, 0, s.c_str( ), slength, buf, len );
std::wstring res( buf );
delete[] buf;
return res;
}
|