Je erreurs à la compilation avec la ligne au fondComment utiliser FindFirstFile
hFind = FindFirstFile(fileFilter.c_str()), &FindFileData);
Le compilateur ne cesse de lancer error C2664 back at me, : cannot convert argument 1 from 'const char *' to 'LPCWSTR'
Comment puis-je créer un LPCWSTR à un std :: string pour passer à en FindFirstFile?
La section de code est pour référence.
Le code actuel suit ci-dessous.
using namespace std;
void GetFileListing(string directory, string fileFilter, bool recursively = true)
{
if (recursively)
GetFileListing(directory, fileFilter, false);
directory += "\\";
WIN32_FIND_DATA FindFileData;
HANDLE hFind ;
string filter = directory + (recursively ? "*" : fileFilter);
string Full_Name;
string Part_Name;
// the line causing the compile error
hFind = FindFirstFile(fileFilter.c_str()), &FindFileData);
Utilise wstring au lieu de chaîne –