Click to See Complete Forum and Search --> : How to search for files in a directory and subdirectorie


Fouly
March 7th, 2009, 01:44 AM
The following question is asked in regards to the following FAQ (http://www.codeguru.com/forum/showthread.php?t=312461):


I got an error on the following line of code:

hFile = ::FindFirstFile(strPattern.c_str(), &FileInformation);
Error 4 error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'

I think it's a Unicode error but i don't know how to resolve it!!!

Andreas Masur
March 7th, 2009, 10:43 AM
The FAQ is not unicode-aware...thus in your case...you need to use 'std::wstring' instead of 'std::string'.