C++获取某个目录下的所有图片
vector<string> getImages(string path) { vector<string> imagesList; intptr_t hFile = 0; struct _finddata_t fileinfo; string p; hFile = _findfirst(p.assign(path).append("\\*.jpg").c_str(), &fileinfo); if (hFile != -1) { do { //cout << fileinfo.name << endl; imagesList.push_back(fileinfo.name);//保存类名 } while (_findnext(hFile, &fileinfo) == 0); } return imagesList; }
##############################