Advertisement

File exists?

Started by May 14, 2001 03:08 PM
3 comments, last by pi256 23 years, 9 months ago
Hi! Is there a function (in Win32 API) that tests if a file exists. Something like: bool FileExists(const char* filename); Or must I try to open the file? - pi256
As far as I know, you must try to open the specified file. You would then check if it is sucessfully open. If it is not, return an error stating the file does not exist of the path name is invalid. Something like that. There may be other ways of doing it. I am not sure.

Edem Attiogbe
Edem Attiogbe
Advertisement
Determine file-access permission.

int _access( const char *path, int mode );

The function returns –1 if the named file does not exist or is not accessible in the given mode; in this case, errno is set as follows:

G''luck,
-Alamar
Thx!
Thx!

This topic is closed to new replies.

Advertisement