Reputation: 1174
This code works for windows 7 but doesn't work for windows XP (outputs only part of startup folder path)
#include <iostream>
#include <shlobj.h>
using namespace std;
int main()
{
wchar_t startupFolder[1024];
HRESULT hr = SHGetFolderPath(0, CSIDL_STARTUP, 0, 0, startupFolder);
if (SUCCEEDED(hr))
wcout << L"Startup folder = " << startupFolder << endl;
else
cout << "Error when getting startup folder\n";
getchar();
return 0;
}
output is: Startup folder = C:\Documents and Settings\Admin\ <- cursor is here. Newline is not provided. Also I have russian window xp. I think this is unicode issue.
when I use wprintf I got: C:\Documents and Settings\Admin\???????? .....
Thanks.
Upvotes: 3
Views: 3280
Reputation: 612964
The problem is that the font that your XP console uses does not contain glyphs for the Russian characters you are trying to output. The fonts that Windows 7 ships with and uses by default in its console do have a much broader coverage of Unicode code points. You'll need to configure your console to use a font that contains the glyphs you want.
Upvotes: 3