I've got this piece of code:
const char * c = &(4:); //This pointer contains "JPG" string
//Wide char conversion
wchar_t *cc = new wchar_t[128];
MultiByteToWideChar(CP_ACP, 0, c, -1, cc, wcslen(cc));
Then I declare a wstring variable:
wstring sFilter;
sFilter.append(L"Format: ");
sFilter.append(cc);
sFilter.push_back('\0');
sFilter.append(L"*.");
sFilter.append(cc);
sFilter.push_back('\0');
sFilter.push_back('\0');
const wchar_t * extensionFilter = sFilter.c_str();
I'm forming this wchar_t
to apply a filter to GetOpenFileName
function from WinApi: ofn.lpstrFilter = extensionString;
which is a member of a structure.
Extension filter randomly contains: "3ormat: JPG" or ":ormat: JPG"...
I cannot change project to Unicode just because the IDE I'm working on doesn't allow it. So I need to work with this.