kobibass
asked on
how can I know if file is exist?
hello experts,
is ther a way to check that particular file exist in the working path?
is ther a way to check that particular file exist in the working path?
Use:
CFile::GetStatus()
static BOOL PASCAL GetStatus( LPCTSTR lpszFileName, CFileStatus& rStatus );
Just pass it the name of the file and a reference to a CFileStatus struct. If the call fails it's due to the the file not being there or not being accessible to you.
CFile::GetStatus()
static BOOL PASCAL GetStatus( LPCTSTR lpszFileName, CFileStatus& rStatus );
Just pass it the name of the file and a reference to a CFileStatus struct. If the call fails it's due to the the file not being there or not being accessible to you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Well, this is the MFC topic area so I'd say the "official" MFC method is to use CFile::GetStatus(). ;-)
But either will get you the same result....
But either will get you the same result....
>>But either will get you the same result....
Youi're of course right about this, jhance ;o)
Youi're of course right about this, jhance ;o)
you can use
access C runtime, for example:
if (access(lpszFileName, 00) != -1)
{
// file exist
}