www.pudn.com > server.rar > found.h


//²éÕÒ 
int found(char key[], char argv[])    
{  
	FILETIME   ftCreate,   ftAccess,   ftWrite;    
    SYSTEMTIME   stUTC1,   stLocal1,stUTC2,stLocal2,stUTC3,stLocal3;    
    WIN32_FIND_DATA FindFileData; 
    HANDLE hFind = INVALID_HANDLE_VALUE; 
    char DirSpec[MAX_PATH];  // directory specification 
    DWORD dwError; 
 
    //printf ("Target directory is %s.\n", argv); 
    strcpy (DirSpec, argv); 
    strcat (DirSpec, "\\*"); 
 
    hFind = FindFirstFile(DirSpec, &FindFileData); 
 
    if (hFind == INVALID_HANDLE_VALUE)  
    { 
	   if(!strcmp(key,FindFileData.cFileName)) {return 1;  } 
       return (-1); 
    }  
    else  
    { 
       //printf ("First file name is %s\n", FindFileData.cFileName); 
       while (FindNextFile(hFind, &FindFileData) != 0)  
       { 
		   if(!strcmp(key,FindFileData.cFileName)) { return 1;break;  } 
       } 
       return 0; 
       dwError = GetLastError(); 
       FindClose(hFind); 
       if (dwError != ERROR_NO_MORE_FILES)  
       { 
           printf ("FindNextFile error. Error is %u\n", dwError); 
           return (-1); 
       } 
	} 
    return (0); 
}