Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

to find whether a file is present or not 2

Status
Not open for further replies.

vsuresh

Programmer
Jul 2, 2002
5
CH
hi all
i want to know, is there any function that will find whether a specified
file is present in given path or not.

 
Two possibilities I know of:
- API Function FindFirstFile with the following sintax(MSDN)
HANDLE FindFirstFile(
LPCTSTR lpFileName, // file name
LPWIN32_FIND_DATA lpFindFileData // data buffer
);
- in MFC Construct an object of type CFindFile then call its member function FindFile with the syntax more straight:
virtual BOOL FindFile( LPCTSTR pstrName = NULL, DWORD dwUnused = 0 );

Hope this helps, s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darknees...
 
I use
[tt]
OFSTRUCT ofs;
if :):OpenFile(fname,&ofs,OF_EXIST)!=HFILE_ERROR)
{
// it exists
}
else
{
// it doesn't exist
}
[/tt]
, but I guess I'm just that kind of guy.
 
GetFileAttributes("..path....");
returns an unsigned -1 if file or directory doesn't exist
John Fill
1c.bmp


ivfmd@mail.md
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top