ffsco 類別將 Win32 FindFirstFile/FindNextFile 遞迴搜尋功能簡單封裝,支援子目錄遞迴、多副檔名過濾、結果儲存於 std::vector<std::string>,介面極簡單。
vector / stringvector/string 基本操作FindFirstFile/FindNextFile 列舉檔案/目錄。match 方法實作自訂比對演算法。#include "ffsco.h"
using namespace helper_coffs;
ffsco o;
// o.dirs(1); // 啟用子目錄遞迴 (預設關閉)
// o.limit(100); // 限制最大結果筆數 (預設 65536,上限 1048576)
int count = o.find("c:\\winnt", "*.exe; *.dll; *.ini");
// 或 int count = o.find("c:\\winnt"); // 全部檔案
// 取得結果
ffsco::typeT files = o.co_file(); // 所有檔案
ffsco::typeT dirs = o.co_dir(); // 所有目錄
ffsco::typeT all = o.co(); // 檔案+目錄混合
for (ffsco::typeT::iterator it = files.begin(); it != files.end(); ++it)
cout << *it << endl; // 任意處理
test/:基本用法test2/:GUI 示範程式
ffsco 以最小介面提供最大彈性,歡迎開發者根據需求擴充 (如加入檔案大小、時間過濾等)。完整原始碼請參考附件。