Newbie: converting a fs::path to std::string?
Morning all I am trying to do: <snip> #include "boost/filesystem/fstream.hpp" namespace fs=boost::filesystem; int produce_lists(fs::path homedir) { fs::path del_fn = homedir / ".wkhm/deletions"; fs::path cr_fn = homedir / ".wkhm/creations"; fs::ofstream deletionsfile (del_fn); fs::ofstream creationsfile (cr_fn); // ensure that the deletions are always transferred creationsfile << homedir << ".wkhm/deletions" << std::endl; } and the << operator does not try to convert fs::path to std:: string. Best way of handling this? Any suggestions welcomed Alan -- Alan Robert Clark, Pr Eng Computational Electromagnetics Associate Professor Wits University School of Electrical and Information Engineering Wits; Gauteng ``Bugs are later known as features'' 2050 South Africa Ps 111:10; Ps 37/150 Fax (+27 11)403-1929 a.clark@ee.wits.ac.za Tel (+27 11)717-7223(24hr) http://YingTongDiddleiPo.ee.wits.ac.za/ GPG Public Key at http://YingTongDiddleiPo.ee.wits.ac.za/arc.gpg **Linux ---the choice of a GNU generation.**
-----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users- bounces@lists.boost.org] On Behalf Of Alan Robert Clark Sent: Thursday, May 17, 2007 4:34 AM To: boost-users@lists.boost.org Subject: [Boost-users] Newbie: converting a fs::path to std::string?
the << operator does not try to convert fs::path to std:: string. Best way of handling this?
[Nat] Which string do you want? There are a number of strings you can retrieve from a boost::filesystem::path: http://boost.org/libs/filesystem/doc/tr2_proposal.html#basic_path-observ ers Just call one of those methods in your << path.method() << expression.
participants (2)
-
Alan Robert Clark
-
Nat Goodspeed