void getFiles(string path, vector<string>& files) { intptr_t hFile = 0; struct _finddata_t fileinfo; string p; long i; if ((hFile = _findfirst(p.assign(path).append("\\*").c_str(), &fileinfo)) != -1) { do {
//判断是否为文件夹 if ((fileinfo.attrib & _A_SUBDIR)) {
//过滤 ../ ./文件夹 if (strcmp(fileinfo.name, ".") != 0 && strcmp(fileinfo.name, "..") != 0) getFiles(p.assign(path).append("\\").append(fileinfo.name), files); } else { files.push_back(p.assign(path).append("\\").append(fileinfo.name)); } } while (_findnext(hFile, &fileinfo) == 0); _findclose(hFile); } }
遍历文件夹
猜你喜欢
转载自www.cnblogs.com/raorao1994/p/8874428.html
今日推荐
周排行