#include <windows.h>
#include <iostream>
using namespace std;
int main() {
char* file="d:/tester";
WIN32_FIND_DATA FindFileData;
HANDLE hFind;
hFind = FindFirstFile(file, &FindFileData); // line of error says argument of type char* is incompatible with parameter of type LPCWSTR
}
I can’t understand the error.What is it and how can I solve the error?
I am making a console app and need to check if files are in there in the directory .
You are calling function that expects wide character string (
FindFirstFileW). You either change file to usewchar_t* file = L"d:\\tester";or use an ASCII version of the functionFindFirstFileA.