Boost logo

Boost Users :

Subject: Re: [Boost-users] boost::filesystem path problem under WINDOWS
From: avanindra singh (singh_avanindra_at_[hidden])
Date: 2010-12-13 14:01:14


Hi Ian,
escape character is not the problem. I would put my code here:
#include "stdafx.h"#include "Windows.h"#include <boost/filesystem/operations.hpp>#include <boost/filesystem/fstream.hpp>#include <iostream>#include "string"#include "conio.h"#include "vector"#include <boost/exception/diagnostic_information.hpp>
#define BOOST_WINDOWS_PATH #define BOOST_WINDOWS_APIusing namespace std;using namespace boost::filesystem; 

extern "C" void straight_to_debugger(unsigned int, EXCEPTION_POINTERS*){    throw;}extern "C" void (*old_translator)(unsigned, EXCEPTION_POINTERS*)         = _set_se_translator(straight_to_debugger);

int _tmain(int argc, _TCHAR* argv[]){ string _path = "E:\\doggy";
        path dir_path(_path.c_str());    vector< pair<string,bool> > _file_jpeg_pair;      string full_list_path = _path+"\\" + "list.txt";    string bundle_path_str = _path+"\\" + "bundle";    path bundle_path(_path.c_str());    //creating bundle directory  cout<<bundle_path<<endl;
  //boost::system::system_error exceptions;  //if( !exists( bundle_path ) )  try{   create_directory(bundle_path);  }  catch(boost::system::system_error const &e)  {   cerr<<diagnostic_information(e)<<endl;  }  cout<<"directory created "<<endl;
  getch();
        return 0;}
You can see that, I have used proper path. The problem is the Windows style path is getting converted somehow in POSIX format. As I printed the path and it came out to be
E:/doggy
Can you point me what mistake I am doing here.
ThanksAvanindra
--- On Mon, 13/12/10, Ian Bruntlett <ian.bruntlett_at_[hidden]> wrote:

From: Ian Bruntlett <ian.bruntlett_at_[hidden]>
Subject: Re: [Boost-users] boost::filesystem path problem under WINDOWS
To: boost-users_at_[hidden]
Date: Monday, 13 December, 2010, 11:33 PM

Hi avanindra,

std::exception::what: boost::filesystem::create_directory: The filename, directory name, or volume label syntax is incorrect: "E:\doggy"
OK, I don't have the full story here. Is the directory name being specified in the C++ source code? If so then remember that "\" is used for character escape sequences. If you are specifying the name in the source code, you may need to type "E:\\doggy". The double "\" will resolve to a single "\" in the executable.

HTH,

Ian

-- 
-- ACCU - Professionalism in programming - http://www.accu.org/ 
-----Inline Attachment Follows-----
_______________________________________________
Boost-users mailing list
Boost-users_at_[hidden]
http://lists.boost.org/mailman/listinfo.cgi/boost-users




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