
Hi: I am using boost.filesystem to hold a path including filename. would the function stem() of the path object give me the path excluding the filename? If i have: c:\program files\boost\welcome.txt The output wanted is: c:\program files\ Any help apreciated. Sean.

On Mon, Feb 2, 2009 at 13:05, Sean Farrow <sean.farrow@seanfarrow.co.uk> wrote:
I am using boost.filesystem to hold a path including filename. would the function stem() of the path object give me the path excluding the filename? If i have: c:\program files\boost\welcome.txt The output wanted is: c:\program files\ Any help apreciated.
path("c:\program files\boost\welcome.txt").parent_path().parent_path() will give you path("c:\program files") This table is often the easiest way to find out which function you need: http://www.boost.org/libs/filesystem/doc/reference.html#Path-decomposition-t...

Hi: Cheers Scott. How can I obtain this path as a string? Sean. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Scott McMurray Sent: 02 February 2009 18:16 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost.filesystem] query On Mon, Feb 2, 2009 at 13:05, Sean Farrow <sean.farrow@seanfarrow.co.uk> wrote:
I am using boost.filesystem to hold a path including filename. would the function stem() of the path object give me the path excluding the filename? If i have: c:\program files\boost\welcome.txt The output wanted is: c:\program files\ Any help apreciated.
path("c:\program files\boost\welcome.txt").parent_path().parent_path() will give you path("c:\program files") This table is often the easiest way to find out which function you need: http://www.boost.org/libs/filesystem/doc/reference.html#Path-decompositi on-table _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users __________ Information from ESET NOD32 Antivirus, version of virus signature database 3819 (20090202) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 3819 (20090202) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com

On Mon, Feb 2, 2009 at 13:38, Sean Farrow <sean.farrow@seanfarrow.co.uk> wrote:
Cheers Scott. How can I obtain this path as a string?
path_string() or external_path_string() http://www.boost.org/libs/filesystem/doc/reference.html#basic_path-observers

Hi: I now get the error that path_string is not a member of boost::filesystem::basic_path<String,Traits> Do I need to pass the path to path_string? Sean. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Scott McMurray Sent: 02 February 2009 18:57 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost.filesystem] query On Mon, Feb 2, 2009 at 13:38, Sean Farrow <sean.farrow@seanfarrow.co.uk> wrote:
Cheers Scott. How can I obtain this path as a string?
path_string() or external_path_string() http://www.boost.org/libs/filesystem/doc/reference.html#basic_path-obser vers _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users __________ Information from ESET NOD32 Antivirus, version of virus signature database 3819 (20090202) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 3819 (20090202) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com

On Mon, Feb 2, 2009 at 14:14, Sean Farrow <sean.farrow@seanfarrow.co.uk> wrote:
I now get the error that path_string is not a member of boost::filesystem::basic_path<String,Traits> Do I need to pass the path to path_string?
Check the documentation for the version of boost you have installed; You may have an older version with different names. Further assistance would require a testcase from you.

Hi: I've sorted this, but when appending to this string, (a new file name) do I need to use 1 or 2 backslashes? So either: Path.string().append("\\file.dll"); Or Path.string().append("\file.dll"); Cheers Sean. -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Scott McMurray Sent: 02 February 2009 19:24 To: boost-users@lists.boost.org Subject: Re: [Boost-users] [boost.filesystem] query On Mon, Feb 2, 2009 at 14:14, Sean Farrow <sean.farrow@seanfarrow.co.uk> wrote:
I now get the error that path_string is not a member of boost::filesystem::basic_path<String,Traits> Do I need to pass the path to path_string?
Check the documentation for the version of boost you have installed; You may have an older version with different names. Further assistance would require a testcase from you. _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users __________ Information from ESET NOD32 Antivirus, version of virus signature database 3819 (20090202) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __________ Information from ESET NOD32 Antivirus, version of virus signature database 3819 (20090202) __________ The message was checked by ESET NOD32 Antivirus. http://www.eset.com

Sean Farrow a écrit :
Hi: I've sorted this, but when appending to this string, (a new file name) do I need to use 1 or 2 backslashes?
You have to buy a book about C++, and read the documentation about the ML. You must escape the slash. -- Mickaël Wolff aka Lupus Michaelis Racine <http://lupusmic.org> Blog <http://blog.lupusmic.org>

Mickael Wolff wrote:
Sean Farrow a écrit :
Hi: I've sorted this, but when appending to this string, (a new file name) do I need to use 1 or 2 backslashes?
snipped context: So either: Path.string().append("\\file.dll"); Or Path.string().append("\file.dll");
You have to buy a book about C++, and read the documentation about the ML. You must escape the slash.
Why not use the path operator/ and not worry about these issues. I think you can: Path / "file.dll" Jeff
participants (4)
-
Jeff Flinn
-
Mickael Wolff
-
Scott McMurray
-
Sean Farrow