"sword" <so***********@ gmail.comwrote in message
news:11******** ************@m7 3g2000cwd.googl egroups.com...
: How can I check whether a file exists?
You'll get the same answer here as in the C NG ;)
The portable way to check for this is to try to open
the file (you may use ifstream, or fopen as in C)
to check if it succeeds, then close it immediately.
Two main issues are:
- various operating systems may have various
restrictions on visibility or accessibility
of files within a given storage/directory.
- on a multitasking OS, a file that exists
at a given time may be deleted by the next
statement.
So in general, best is to just try to use the file,
and report the error at that point.
hth-Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <
http://www.brainbench.com