Boost logo

Boost :

From: Beman Dawes (bdawes_at_[hidden])
Date: 2005-09-28 20:56:56


"Reece Dunn" <msclrhd_at_[hidden]> wrote in message
news:dhf67p$5n7$1_at_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


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk