test if a File exist or not?
-
I'm sorry I meant to say if there is a method that test if a File exist or not? thanks! alantop
one way
WIN32_FIND_DATA m_data;
HANDLE hFile;hFile=FindFirstFile(filename,&m_data)
if(hFile==INVALID_HANDLE_VALUE) //file not found
-
I'm sorry I meant to say if there is a method that test if a File exist or not? thanks! alantop
You can use SHGetFileInfo() The prototype of the function is as follows:
DWORD_PTR SHGetFileInfo( LPCTSTR pszPath, DWORD dwFileAttributes, SHFILEINFO *psfi, UINT cbFileInfo, UINT uFlags );
;-) _AnShUmAn_ -
I'm sorry I meant to say if there is a method that test if a File exist or not? thanks! alantop
and PathFileExists
-
one way
WIN32_FIND_DATA m_data;
HANDLE hFile;hFile=FindFirstFile(filename,&m_data)
if(hFile==INVALID_HANDLE_VALUE) //file not found
Make sure you close the handle if the file is found. Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
-
Make sure you close the handle if the file is found. Anyone who thinks he has a better idea of what's good for people than people do is a swine. - P.J. O'Rourke
sure and thank you use
FindClose(hFile);
-
and PathFileExists
Hi, When I use "PathFileExists()" in my MFC code, it is giving me Linking error as follows, Linking... aDlg.obj : error LNK2001: unresolved external symbol __imp__PathFileExistsA@4 Debug/a.exe : fatal error LNK1120: 1 unresolved externals Is ther any Library/ Header File for it? Best Regards, Aniket
-
Hi, When I use "PathFileExists()" in my MFC code, it is giving me Linking error as follows, Linking... aDlg.obj : error LNK2001: unresolved external symbol __imp__PathFileExistsA@4 Debug/a.exe : fatal error LNK1120: 1 unresolved externals Is ther any Library/ Header File for it? Best Regards, Aniket
#include shlwapi.h
and to your project
import shlwapi.lib -
#include shlwapi.h
and to your project
import shlwapi.lib -
I'm sorry I meant to say if there is a method that test if a File exist or not? thanks! alantop
_access(..., 0)
is one way.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"We will be known forever by the tracks we leave." - Native American Proverb