1 vector<CString> str_vector; 2 CFileFind finder; 3 CString filepathname; 4 CString str_file =_T(“F:\\TDDOWNLOAD"); 5 BOOL YesNo=finder.FindFile(str_file+_T("\\*.jpg")); 6 //BOOL YesNo=finder.FindFile(str_file+_T("\\*.bmp")); 7 while (YesNo) 8 { 9 YesNo=finder.FindNextFile(); 10 filepathname=finder.GetFilePath(); 11 str_vector.push_back(filepathname); 12 }
http://zhidao.baidu.com/link?url=Jki544MnviBpapc2tjUG2emjVxhiocSuq8m9xWyi29VyP-w87TE6j3tOj8-gehpoPYjUgRBuXpUTRWTvHBejgq
本文介绍了一个使用C++编写的程序片段,该程序能够遍历指定目录(例如'F:\TDDOWNLOAD')并收集所有的.jpg图片文件路径。通过使用CFileFind类,此代码有效地实现了对特定类型文件的搜索,并将找到的文件路径存储在一个vector容器中。
748

被折叠的 条评论
为什么被折叠?



