|
// Give you a custom function to get whether the specified file exists
bool FileExist (LPCTSTR szFindPath)
{
int count = 0;
int i = 0;
WIN32_FIND_DATA fd;
HANDLE hFind;
if (strlen ((char *) szFindPath) <= 0)
return false;
char path [257];
char * pPath;
pPath = path;
count = strlen (szFindPath);
if (count <= 0)
return false;
// Get the path string from front to back
for (i = 0; i <count; i ++)
{
if (* (szFindPath + i) == '\\')
break;
* (pPath + i) = * (szFindPath + i);
}
* (pPath + i) = '\\';
* (pPath + i + 1) = '\0';
hFind = FindFirstFile (szFindPath,&fd);
if (hFind! = INVALID_HANDLE_VALUE)
{
FindClose (hFind);
}
return hFind! = INVALID_HANDLE_VALUE;
} |
|