void FeatureClassSelectDlg::GetDirectory(CString strPath,vector <CString>& dirs)
{
//临时数组
vector <CString> temp_files;
vector <CString> temp_paths;
CString strFilePath;
int dwDirSize = 0;
strFilePath += strPath;
strFilePath += "//*.*";
CFileFind finder;
BOOL bFind = finder.FindFile(strFilePath);
while (bFind)
{
bFind = finder.FindNextFile();
if (!finder.IsDots())
{
CString strPath = finder.GetFilePath();
CString strName = finder.GetFileName();
if (finder.IsDirectory())
{
//文件夹
dirs.push_back(strName);
m_strPathList.push_back(strPath);
}
else
{
//文件
temp_files.push_back(strName);
temp_paths.push_back(strPath);
}
}
}
//合并文件与文件夹
unsigned int i(0);
for (i=0;i<temp_files.size();i++)
{
dirs.push_back(temp_files[i]);
m_strPathList.push_back(temp_paths[i]);
}
finder.Close();
}
获取文件夹下所有子文件夹名
最新推荐文章于 2023-06-07 10:35:26 发布