void TraverseFolder()
{
CString extension;
CString folderPath = "D:\\Desktop\\txtFile\\";
CFileFind fFind;
CString fileName;
extension += _T(folderPath);
extension += _T("*.txt");
BOOL bRes = fFind.FindFile(extension);
while (bRes)
{
bRes = fFind.FindNextFile(); // 使用 GetFileName() 之前一定要先调用 FindNextFile()
fileName = fFind.GetFileName();
}
}
网友评论