Returning a file name
-
How can I check for the existence of a file in a directory? I need to check it before overwriting the file. Thx, Ralf. ralf.riedel@usm.edu
-
How can I check for the existence of a file in a directory? I need to check it before overwriting the file. Thx, Ralf. ralf.riedel@usm.edu
Try PathFileExists(), declared in shlwapi.h. You need to link with shlwapi.lib. Dave
-
How can I check for the existence of a file in a directory? I need to check it before overwriting the file. Thx, Ralf. ralf.riedel@usm.edu
#include < io.h > if (_access(filename, 0) == 0) { the file exists } -c
Image tools: ThumbNailer, Bobber, TIFFAssembler
-
How can I check for the existence of a file in a directory? I need to check it before overwriting the file. Thx, Ralf. ralf.riedel@usm.edu
RalfPeter wrote: How can I check for the existence of a file in a directory? I need to check it before overwriting the file. Thx, Ralf. Windows, C runtime versions already submitted, but if you are addicted to MFC try the following...
BOOL FileUtil::FileExists(const CString& strFile)
{
CFileStatus fs;
if (!CFile::GetStatus(strFile, fs))
return FALSE;
else
return TRUE;
} -
How can I check for the existence of a file in a directory? I need to check it before overwriting the file. Thx, Ralf. ralf.riedel@usm.edu
i can`t believe these answers ! check this out : you can use relative or full path ! unsigned long FileSize(const char *fullpath) { _finddata_t data; long handle=0; handle=_findfirst(fullpath,&data); if(handle==-1) return -1; _findclose(handle); if(data.attrib & _A_SUBDIR) { return -1; } return data.size; } BOOL FileExists(const char *fullpath) { _finddata_t data; long handle=0; handle=_findfirst(fullpath,&data); if(handle==-1) return 0; _findclose(handle); if(data.attrib & _A_SUBDIR) { return 0; } return 1; } //be cool I am the mighty keeper of the book on knowledge . Contact me to get your copy .