1. Introduction
File lookups can be useful in many situations, class ffsco a simple encapsulation of file lookup operations, using only the pass parameter lookup path and file matching format (which can inherit the match method of the class to implement its own matching algorithm) to the Find method, the query results (files/directories, etc.) are saved to the inside of the class Vector containers, you can use whatever you want.
Requirements:
System support Standard C++/vector/string
Users understand Vector/string
2, the description
Findfirstfile/findnextfile implemented using functions provided by WIN32. Recursive method for subdirectory lookup.
3, the use of methods
Add file ffsco.h/ffsco.cpp to include file ffsco.h, e.g in place of use.
#include "ffsco.h"
Add name space Use declaration:
using namespace helper_coffs;
Define Ffsco class objects:
ffsco o;
Set whether to find subdirectories:
//o.dirs(1); //--查找子目录
Set the maximum number of search results (default 65536/maximum 1048576 of course you can modify the limit):
//o.limit(100); //--最多查找100个
Start lookup (return number of results):
int count = o.find(path, fext);
//int count = o.find("c:\\winnt");
//int count = o.find("c:\\winnt", "*.exe; *.dll; *.ini");
//int count = o.find("c:\\winnt\\", "*.exe; *.dll; *.ini");