FindFirstFile error C2664
Posted on 2006-06-14
I'm using FindFirstFile to get a list of directories.
In the past I've used it as shown below with VS2005. In this new project I'm getting a C2664 error because it wants the first parameter to be type LPCWSTR and that a const char*.
I can just cast it to a LPCWSTR but does anybody know why this error is showing up?
HANDLE hFind = INVALID_HANDLE_VALUE;
string myDir = "C:\\Temp\\*";
hFind = FindFirstFile(myDir.c_str(), &FindFile);
This results in the following:
error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char *' to 'LPCWSTR'