bool Search(TCHAR *Path,TCHAR *File)
{
HANDLE hFind;
WIN32_FIND_DATA wfd;
ZeroMemory(&wfd,sizeof(WIN32_FIND_DATA));
TCHAR PathTemp[];
memset(PathTemp,,sizeof(PathTemp));
wsprintf(PathTemp,L"%s\\*",Path); hFind=FindFirstFile(PathTemp,&wfd);
if(INVALID_HANDLE_VALUE==hFind)
{
goto End;
}
do
{
if('.'==wfd.cFileName[]){
continue;
} if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
wsprintf(PathTemp,L"%s\\%s",Path,wfd.cFileName);
Search(PathTemp,File);
}
else
{
WCHAR PathTemp1[]={};
wsprintf(PathTemp1,L"%s\\%s",Path,wfd.cFileName);
OutputDebugString(PathTemp1);
}
}while(FindNextFile(hFind,&wfd)); End:
FindClose(hFind);
return true;
} //调用 CString Tmp(L"C:\\test");
Search(Tmp.GetBuffer(),L"b.txt");