簡體   English   中英

c ++子獲取當前目錄中的所有exe文件

[英]c++ sub get all exe files in current directory

c ++子獲取當前目錄中的所有exe文件

我正在嘗試獲取當前目錄中的所有.exe文件。

但我有一些錯誤,有人可以糾正我。

編輯:

我有這個2錯誤:

1 / IntelliSense:“ WIN32_FIND_DATA *”類型的參數與“ LPWIN32_FIND_DATAA”類型的參數不兼容

2 / IntelliSense:“ WCHAR *”類型的參數與“ 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM