Looking for a file
-
here's a function that I put in one of my programs to make sure a folder existed, but you could also use it for a file.
BOOL FolderExists(CString strFolderName) { return GetFileAttributes(strFolderName) != INVALID_FILE_ATTRIBUTES; }
My articles www.stillwaterexpress.com BlackDice
-
Try this:
bool fileExists(LPCTSTR filepath)
{
return (_taccess(filepath, 00) == 0);
}Hope that helps, -- jlr http://jlamas.blogspot.com/[^]
-
Another way:
WIN32_FIND_DATA wfd; HANDLE hFind = FindFirstFile(csFilePath, &wfd); if (hFind != INVALID_HANDLE_VALUE) // File exists ...
Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits. -
Another way:
WIN32_FIND_DATA wfd; HANDLE hFind = FindFirstFile(csFilePath, &wfd); if (hFind != INVALID_HANDLE_VALUE) // File exists ...
Marc Soleda. ... she said you are the perfect stranger she said baby let's keep it like this... Tunnel of Love, Dire Straits. -
Try this:
bool fileExists(LPCTSTR filepath)
{
return (_taccess(filepath, 00) == 0);
}Hope that helps, -- jlr http://jlamas.blogspot.com/[^]
-
here's a function that I put in one of my programs to make sure a folder existed, but you could also use it for a file.
BOOL FolderExists(CString strFolderName) { return GetFileAttributes(strFolderName) != INVALID_FILE_ATTRIBUTES; }
My articles www.stillwaterexpress.com BlackDice
-
Try one of the stat functions, e.g.
int stat (const char *path, struct _stat *buffer);