Boost logo

Boost Users :

From: Jeff (jeff_j_dunlap_at_[hidden])
Date: 2007-04-26 06:23:30


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)
  ...

The reason for my concern is that I am going to be reading a text document
containing a list of files, and all that I need to know is if the files exist
on disk or not. If there is a way to check without opening each one, that
would be ideal.

Thanks in Advance


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net