
29 Sep
2005
29 Sep
'05
1:56 a.m.
"Reece Dunn" <msclrhd@hotmail.com> wrote in message news:dhf67p$5n7$1@sea.gmane.org...
... The proper way to implement exists( ... ) on Windows is to do:
#include "shlwapi.h" // link to shlwapi.lib
bool exists( const path & ph ) { return ::PathFileExistsA( ph.string().c_str()) == TRUE; }
In proposal to the standards committee, exists() is specified in terms of the results of POSIX stat(). On Windows, the best way to achieve that might be to use Windows Run-Time library's _stat() and _wstat() functions. The docs for those functions specifically say "A return value of -1 indicates an error, in which case errno is set to ENOENT, indicating that the filename or path could not be found." --Beman