#include <io.h>
bool ParseDose::GetImageFileName(std::string catalog, std::vector<std::string>& lstFileName)
{
intptr_t hFile = 0;
struct _finddata_t fileInfo;
std::string pathName, exdName;
// \\* 代表要遍历所有的类型,如改成\\*.jpg表示遍历jpg类型文件
if ((hFile = _findfirst(pathName.assign(catalog).append("\\*").c_str(), &fileInfo)) == -1)
{
return false;
}
do
{
//判断是否是文件夹
if (fileInfo.attrib & _A_SUBDIR)
{
continue;
}
//屏蔽常用文件(因为我们只取dicom文件)
std::string str = fileInfo.name;
if ((str.find(".pdf") != -1) || (str.find(".doc") != -1) || (str.find(".docx") != -1) || (str.find(".bat") != -1) || (str.find(".jpg") != -1) || (str.find(".txt") != -1)
|| (str.find(".jpeg") != -1) || (str.find(".png") != -1) || (str.find
C++获取目录下的所需文件
最新推荐文章于 2023-01-29 20:11:20 发布