CFileFind fileFind;
int i = 0;
CString strdir = m_strDirPath + _T("\\*.*");
if(fileFind.FindFile(strdir,0))
{
BOOL bRet = TRUE;
while(bRet)
{
bRet = fileFind.FindNextFile();
if(fileFind.IsDots())
{
continue;
}
if(!fileFind.IsDirectory())
{
//str.push_back(fileFind.GetFilePath());
strDir[i++] = fileFind.GetFilePath();
}
else
{
CFileFind filefind;
strdir = fileFind.GetFilePath() + _T("\\*.*");
filefind.FindFile(strdir,0);
BOOL Ret = TRUE;
while(Ret)
{
Ret = filefind.FindNextFile();
if(filefind.IsDots())
{
continue;
}
//str.push_back(filefind.GetFilePath());
strDir[i++] = filefind.GetFilePath();
}
filefind.Close();
}
}
fileFind.Close();
}
VC++遍历指定目录下的所有文件
最新推荐文章于 2019-05-02 18:21:06 发布