MFC 文件遍历

对文件的操作MFC提供了CFileFind 类,运用此类,我们可以轻松的多文件进行操作

假设我们删除当前目录下所有jpg格式的图片:

 

 CFileFind finder; 

 CFile fp;

 bool All_File=finder.FindFile("*.jpg"); 

 while(All_File)

 {

  All_File=finder.FindNextFile(); 



   CString strin;

  strin=finder.GetFileName();

  fp.Remove(_T(strin));

 }

 

你可能感兴趣的:(mfc)