Boost logo

Boost Users :

From: frederic.bron_at_[hidden]
Date: 2008-07-16 03:03:57


1. works fine on my windows platform.
2. Strange that you say that C:/autoexec.bat is native. I would say C:\autoexec.bat is but this is not where you get the error.
3. What is your compiler? With some, you need to compile with macro BOOST_WINDOWS_API.

F. Bron

boost-users-bounces_at_[hidden] a écrit sur 16/07/2008 08:40:35 :

> Hello,
>
> I want to use the Boost.Filesystem library in my Win32 application.
> I've stumbled upon a problem which may very well be my
> misunderstanding of how to use the library but reading the
> documentation doesn't clear up my confusion.
>
> The user choses a path from a native UI and a bfs::path is
> constructed with the native name checker. This path needs to be
> persisted so I call the string() method which according to the
> documentation "Returns: The contents of m_name, formatted according
> to the rules of the generic path string grammar." I figured this
> string would be acceptable to the bfs::path constructor without
> specifying native because it's in the corrct grammar but I get an
> exception thrown. Here's a stripped down version of my code:
>
> #include <iostream>
> #include <iterator>
> #include <boost/filesystem/operations.hpp>
> namespace bfs = boost::filesystem;
> int main()
> {
> try
> {
> // Path constructed from a native UI so constructed with native
> bfs::path myPath("C:/autoexec.bat",bfs::native);
> // Persist to grammar conformant string
> std::string persisted = myPath.string();
> // Recreate from persisted string - *THROWS EXCEPTION*
> bfs::path otherPath(persisted);
> }
> catch(const std::exception& e)
> {
> std::cout << e.what() << std::endl;
> }
> return 0;
> }
>
> The exception string is "boost::filesystem::path: invalid name "C:"
> in path: "C:/autoexec.bat""
>
> Can someone explain how I should be doing this please?
>
> Thanks,
>
> Pete_______________________________________________
> Boost-users mailing list
> Boost-users_at_[hidden]
> http://lists.boost.org/mailman/listinfo.cgi/boost-users

Avis :
Ce message et toute pièce jointe sont la propriété d'Alcan et sont destinés seulement aux personnes ou à l'entité à qui le message est adressé. Si vous avez reçu ce message par erreur, veuillez le
détruire et en aviser l'expéditeur par courriel. Si vous n'êtes pas le destinataire du message, vous n'êtes pas autorisé à utiliser, à copier ou à divulguer le contenu du message ou ses pièces jointes
en tout ou en partie.

Notice:
This message and any attachments are the property of Alcan and are intended solely for the named recipients or entity to whom this message is addressed. If you have received this message in error
please inform the sender via e-mail and destroy the message. If you are not the intended recipient you are not allowed to use, copy or disclose the contents or attachments in whole or in part.


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