TCHAR buf[MAX_PATH];
int aFolder = CSIDL_APPDATA;
if (SHGetFolderPath(NULL, aFolder, NULL, SHGFP_TYPE_CURRENT, buf) != S_OK)
*buf = '\0';
// buf wchar_t
std::wstring str(&buf[0]); //convert to wstring
std::string str2(str.begin(), str.end()); //and convert to string.
std::string str3 = "\\settings.ini";
auto dir = str2 + str3;
warning:
conversion from 'wchar_t' to 'const _Elem', possible loss of data
1> with
1> [
1> _Elem=char
1> ]
What other way can I do this conversion without "possible loss of data"
?
I have also tried to use SHGetFolderPathW()
but it returns the same warning.