After spending some more time on this, we finally decided to use a different approach that worked for me.
So, we converted wchar_t * to a string using this method:
// Converts LPWSTR to string bool convertLPWSTRToString(string& str, const LPWSTR wStr) { bool b = false; char* p = 0; int bSize; // get the required buffer size in bytes bSize = WideCharToMultiByte(CP_UTF8, 0, wStr,-1, 0,0, NULL,NULL); if (bSize > 0) { p = new char[bSize]; int rc = WideCharToMultiByte(CP_UTF8, 0, wStr,-1, p,bSize, NULL,NULL); if (rc != 0) { p[bSize-1] = '\0'; str = p; b = true; } } delete [] p; return b; }
And then I saved this line in the set, having done this, I didnβt have to worry about comparing the elements that are stored to make sure that all records are unique.
// set that will hold unique path set<string> strSet;
So all I had to do was:
string str; convertLPWSTRToString(str, FileName);
Although I still donβt know what caused the "Debug with error" error when I used a set comparator (PathComp) for set<wchar_t*,PathComp> pathSet;
sactiw
source share