c++ sub get all exe files in current directory
I'm trying to get all the .exe
files in current directory.
but I have some error, can someone correct me.
edit :
i have this 2 error :
1/ IntelliSense: argument of type "WIN32_FIND_DATA *" is incompatible with parameter of type "LPWIN32_FIND_DATAA"
2/ IntelliSense: argument of type "WCHAR *" is incompatible with parameter of type "const char *"
void ml()
{
WIN32_FIND_DATA Finde;
HANDLE hFind;
hFind = FindFirstFileA("*.exe", &Finde);
if(strcmp(Finde.cFileName,"test.exe") != 0 )
{
strong(Finde.cFileName);
}
while(FindNextFileA(hFind,&Finde))
{
if(FindFileData.cFileName,"test.exe")
{
strong(Finde.cFileName);
}
}
FindClose(hFind);
}
两件事:1.您需要检查hFind是否有效2.循环中的“ if”是否缺少strcmp
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.