Advertisement

Checking if a file exists

Started by February 08, 2000 01:50 PM
2 comments, last by bosjoh 24 years, 10 months ago
Is there a function that checks the presence of a file in MSVC++ 6.0? (Like the __file_exists() function in DJGPP)
You can use CreateFile with the OPEN_EXISTING flag. If it fails then the file doesn''t exist.
Advertisement
#include < io.h>

bool FileExists (const char *filename)
{
if (access(filename, 0) == 0)
return true;

return false;
}
Thanks,
just needed to know that.

This topic is closed to new replies.

Advertisement