These are two completely different L .. The first is part of the C ++ syntax. The prefix of the string literal is c Land it becomes a wide string literal; instead of an array charyou get an array wchar_t.
L LPCWSTR . . , , . L 16- Windows, . , - 64 , , . API-, LP. ; Microsoft , .
LPCWSTR, , W. - char LPCWSTR . , -cast , , , , . . , , , .
const char*, -, L. . ( Windows, LPCSTR - no W.) , , const wchar_t*. , L .
, , . , . std::wstring, std::string, wchar_t char. c_str() a const wchar_t*. wstring, wchar_t.
std::string, - . , , std::string. " ANSI" ; CP_ACP. MultiByteToWideString, .
int required_size = MultiByteToWideChar(CP_ACP, 0, vs[0].c_str(), vs[0].size(), NULL, 0);
if (required_size == 0)
ERROR;
std::vector<wchar_t> wv(required_size);
int result = MultiByteToWideChar(CP_ACP, 0, vs[0].c_str(), vs[0].size(), &wv[0], required_size);
if (result != required_size - 1)
ERROR;
, wchar_t*, : &wv[0]. wstring, :
// The vector is null-terminated, so use "const wchar_t*" constructor
std::wstring ws1 = &wv[0];
// Use iterator constructor. The vector is null-terminated, so omit
// the final character from the iterator range.
std::wstring ws2(wv.begin(), wv.end() - 1);
// Use pointer/length constructor.
std::wstring ws3(&wv[0], wv.size() - 1);