I'm following a simple tutorial (the adrianxw.dk one) to list the files in a directory. The code is this:
Code:
#include <windows.h>
#include <iostream>
using namespace std;
int main()
{
HANDLE hFind;
WIN32_FIND_DATA FindData;
cout << "A very basic FindFirst/Next demo.\n" << endl;
// Find the first file
hFind = FindFirstFile("C:\\Windows\\*.exe", &FindData);
cout << FindData.cFileName << endl;
// Look for more
while (FindNextFile(hFind, &FindData))
{
cout << FindData.cFileName << endl;
}
// Close the file handle
FindClose(hFind);
return 0;
}
However when I try to compile it using Visual C++ Express, I'm given the following error:
Code:
error C2664: 'FindFirstFileW' : cannot convert parameter 1 from 'const char [17]' to 'LPCWSTR'
Can someone please explain what's going wrong?