文件遍历void CBianLiDlg::FileSearch(CString root)
{
// root 为目录名
CFileFind ff;
CString FilePath;
if (root.Right(1)!="/")
{
root+="/";
}
root+="*.*";
BOOL res=ff.FindFile(root);
while (res)
{
res=ff.FindNextFile();
FilePath=ff.GetFilePath();
if (ff.IsDirectory() && !ff.IsDots())// 找到的是文件夹
{
FileSearch(FilePath);// 递归
}
else if (!ff.IsDirectory() && !ff.IsDots())// 找到的是文件
{
m_ff+=FilePath;
m_ff+=" ";
}
}
}
MFC文件遍历文件夹
最新推荐文章于 2024-07-24 14:34:58 发布