CFileFind 遍历目录与子目录

来源:互联网 发布:jq 判断数组是否为空 编辑:程序博客网 时间:2024/04/30 10:23

/*作者:sysprogram

   编写日期:2011年4月2日

   博客:http://hi.csdn.net/SysProgram

*/

 

void MyFindFile(CString strPath)
{
 CFileFind hFileFind;
 strPath+="//*.*";
 BOOL bWorking = hFileFind.FindFile(strPath,0);

 while(bWorking)
 {
  bWorking = hFileFind.FindNextFile( );
  if (hFileFind.IsDots())
  {
   continue;
  }
  if (hFileFind.IsDirectory())
  {
   MyFindFile(hFileFind.GetFilePath());
  }
  OutputDebugString(hFileFind.GetFilePath());
 }
 hFileFind.Close();
}

 

void CTestCFileDlg::OnBUTTONFind()
{
 // TODO: Add your control notification handler code here
 MyFindFile("D://test");
}

 

原创粉丝点击