获取,指定目录的子文件列表,支持递归获取子目录,支持Win32和类Unix系统。
#ifndef _FILE_HELPER_H__
#define _FILE_HELPER_H__
class FileHelper
{
public:
/**
@brief 获取指定文件夹内的文件路径列表
@param string basePath 要搜索的目录路径
@param bool searchSubDir 是否递归搜索子目录
@std::vector<std::string > &files 用于储存搜索结果的向量
*/
static void getFiles(const std::string basePath, std::vector<std::string > &files, bool searchSubDir = true);
};
#endif
原文地址:http://www.cnblogs.com/geequlim/p/3858208.html