boost::filesystem

M

Michael

Is this the correct place to ask about Boost libs?
If it is..............
#include <boost/filesystem/path.hpp>

#include <boost/filesystem/operations.hpp>

using namespace boost;

using namespace boost::filesystem;

int main(int argc, char* argv[])

{

path p("C:/");

}


i am trying to run this on using VC.net compiler and comes back with errors
at runtime, citing an unhandled exception? Is this a problem with

a) my code

b) my compiler setup?



Regards



Michael
 
M

Matthias Kaeppler

Michael said:
Is this the correct place to ask about Boost libs?
If it is..............
#include <boost/filesystem/path.hpp>

#include <boost/filesystem/operations.hpp>

using namespace boost;

using namespace boost::filesystem;

int main(int argc, char* argv[])

{

path p("C:/");

}


i am trying to run this on using VC.net compiler and comes back with errors
at runtime, citing an unhandled exception? Is this a problem with

a) my code

b) my compiler setup?



Regards



Michael

Additionally to what was said, try this:

#include <boost/filesystem/path.hpp>
#include <boost/filesystem/operations.hpp>
#include <bosot/filesystem/exception.hpp>


using namespace boost;
using namespace boost::filesystem;

int main(int argc, char* argv[])
{
try
{
path p("C:/", native );
}
catch( const filesystem_error& e )
{
// handle exception properly
}
}

Note that boost::filesystem throws on a LOT of occasions, even in
situations which are -- in my eyes -- not exceptional at all.
So be sure to always catch possible exceptions and handle them in a sane
way (mostly outputting an error or warning message is sufficient).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top