26 Apr
2007
26 Apr
'07
1:35 p.m.
Johan Nilsson wrote:
Jeff wrote:
Hello,
I can see from a FileSystem example how to check for the existence of a directory. What I would like to be able to do is to check for the existence of a file but I couldn't figure out how to do it using exists().
The way that I currently check for a file's existence is by opening the file. I wonder if boost::filesystem can test for a file's existence more efficiently than having to open it like I do in the snippet below.
// checking for file existence by opening the file ifstream source(fileName); if (source) ...
What about (Boost 1.34):
#include
...
boost::filesystem::exists(fileName);
Oops, I didn't read the first part of the question. See other poster's reply. / Johan