Boost logo

Boost Users :

Subject: Re: [Boost-users] using boost::filesystem::delete
From: Christoph Gysin (christoph.gysin_at_[hidden])
Date: 2009-03-03 12:48:38


2009/3/3 Sean Farrow <sean.farrow_at_[hidden]>:
> I have a boost::filesystem::wpath object. I need to firstly check if the
> file exists, and secondly delete and check the file has been deleted.
> How would I go about this?
> I've loked at the reference and carn't seem to make sense, are thee any
> examples of both these functions?

Check the reference again:
http://www.boost.org/doc/libs/1_38_0/libs/filesystem/doc/reference.html#Operations-functions

#include <boost/filesystem.hpp>

int main(int argc, char *argv[])
{
        boost::filesystem::wpath file(L"file.txt");

        if(boost::filesystem::exists(file))
                boost::filesystem::remove(file);
}

-- 
echo mailto: NOSPAM !#$.'<*>'|sed 's. ..'|tr "<*> !#:2" org_at_fr33z3

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