3/13/2014

C,C++, To get a list of files in a directory using CFileFind function, example source code


        CFileFind finder;
 CString strFileName;
 //CStringList list;
 strFiles.Format("C:\\Demo\\*.avi", pszPathname);
 BOOL bWorking = finder.FindFile(strFiles);
 while(bWorking)
 {
  bWorking = finder.FindNextFile();
  //list.AddTail(finder.GetFileName());
  ::AfxMessageBox(finder.GetFileName());
 }