原地址:https://zhuanlan.zhihu.com/p/85094140
#include <iostream>
#include <string>
#include <io.h>
#include<vector>
using namespace std;
void getFiles(string path, vector<string>& files) {
intptr_t hFile = 0;
_finddata_t fileinfo;
if ((hFile = _findfirst(path.append("/*").c_str(), &fileinfo)) != -1) {
while (_findnext(hFile, &fileinfo) == 0) {
if (strcmp(fileinfo.name, ".."))
files.push_back(fileinfo.name);
}
_findclose(hFile);
}
}
int main() {
string path = "F:\\wzl\\keras_vnet\\2D-Vnet-Keras-master";
vector<string> files;
getFiles(path, files);
for (int i = 0; i < files.size(); i++)
cout << files[i] << endl;
getchar();
return 0;
}