2012-02-10 32 views
-4

FindFirstFile類似的增強功能是什麼?我想在使用boost的文件夾中找到*.exe如何使用boost庫查找所有.exe文件?

例如:

HANDLE handle = FindFirstfile(buf, &finds); 
while(FindNextFile(handle, &finds) { // using file } 
+1

所以你知道Boost,但[Boost.Filesystem](http://www.boost.org/libs/filesystem/)不是一個明顯的候選人? – ildjarn 2012-02-10 02:15:30

+0

我編輯了您的質量和格式問題。將來,請參閱編輯器中提供的幫助以及[FAQ](http://stackoverflow.com/faq)(特別是密切關注'如何提問'部分)。 – 2012-02-10 14:31:09

回答

0

可以使用directory_iterator:

#include <boost/filesystem.hpp> 
using namespace std; 
using namespace boost::filesystem; 

... 

path mypath("/where/ever/"); 

for(directory_iterator it(mypath); ; ++it) { 
    ... 
} 

,並匹配您的條件。

相關問題