I have the following code:
// Fetch Local App Data folder path. PWSTR localAppData = (PWSTR) malloc(128); SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL
I like Praetorina'sPraetorian's answer of just using wide string stream but if you want to convert:
char str[128]; wcstombs(str, localAppData, 128);
There is another function which goes the other way around too:
wchar_t wstr[128]; mbstowcs(wstr, "Hello World", 128);