标签:
1 CString sText; 2 TCHAR szPath[MAX_PATH]; 3 ZeroMemory(szPath, sizeof(TCHAR)*MAX_PATH); 4 GetModuleFileName(NULL, szPath, sizeof(TCHAR)*MAX_PATH); 5 LPTSTR pos01 = _tcsrchr(szPath, ‘\\‘); 6 if (pos01 != NULL) 7 *pos01 = ‘\0‘; 8 CString sFilePath; 9 sFilePath = CString(szPath) +_T("\\Temp\\*.*");
2. 查找文件并删除
1 CFileFind fileFinder; 2 BOOL bFile = fileFinder.FindFile(sFilePath); 3 while(bFile) 4 { 5 bFile = fileFinder.FindNextFile(); 6 7 if(!fileFinder.IsDirectory() && !fileFinder.IsDots()) //当为文件时; 8 { 9 CString strFullName = fileFinder.GetFilePath(); 10 DeleteFile(strFullName); 11 } 12 } 13 14 fileFinder.Close();
标签:
原文地址:http://www.cnblogs.com/jgliuhui1988/p/4284575.html