I want to convert std::string into a const wchar_t *

First convert it to std::wstring: std::wstring widestr = std::wstring(str.begin(), str.end()); Then get the C string: const wchar_t* widecstr = widestr.c_str(); This only works for ASCII strings, but it will not work if the underlying string is UTF-8 encoded. Using a conversion routine like MultiByteToWideChar() ensures that this scenario is handled properly.

Is TCHAR still relevant?

The short answer: NO. Like all the others already wrote, a lot of programmers still use TCHARs and the corresponding functions. In my humble opinion the whole concept was a bad idea. UTF-16 string processing is a lot different than simple ASCII/MBCS string processing. If you use the same algorithms/functions with both of them (this … Read more