Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6923565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:33:06+00:00 2026-05-27T10:33:06+00:00

ok so i wrote a program which scaans all directories an sub directories to

  • 0

ok so i wrote a program which scaans all directories an sub directories to find sepcific file extensions(i pass a string for the extension type i want) then it returns a vector loade with all the filenames with the specific filetype extensions. then i have another class which has a function that print out all of the files in the vector and will then will iterate the vector and run a program in that vector that the user chooses. This is my problem. Getting the file from the vvector to run. i am using visual studios on windows 7
using boost filesystem V3. this is my current function:

#define BOOST_FILESYSTEM_NO_DEPRECATED

#ifndef NotePad__h
#define NotePad__h

#include boost/filesystem.hpp
#include iostream
#include io.h
#include stdlib.h
#include stdio.h
#include cstdlib
#include Windows.h
#include atlstr.h
#include string
#include cstring
;
namespace fs = boost::filesystem;

class NpLaunch 
{
public:
    void Launch (const std::vector<fs::path>& v)
    {
        int count=0;
        std::cout << "launched in notePad.h" << std::endl;
        for(auto i = v.begin(); i!= v.end(); ++i)
        {
            //string s;
            //string val = (string) itr;
            std::cout << count << ". " << *i << std::endl;
            ++count;
            std::string s = i->c_str();
            //std::system(i->c_str());
        }
    }

};

#endif

and this is the error im getting:

Error 1 error C2440: ‘initializing’ : cannot convert from ‘const >boost::filesystem3::path::value_type *’ to ‘std::basic_string<_Elem,_Traits,_Ax>’ >c:\users\admin\documents\visual studio 2010\projects\launcher\launcher\notepad.h 31

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:33:06+00:00Added an answer on May 27, 2026 at 10:33 am

    On Windows, path::value_type is a wchar_t, and thus path::string_type is equivilent to std::wstring, and the path::c_str() method returns a wchar_t*. You cannot assign a wchar_t* to a std::string, that is what the compiler error is trying to tell you.

    To assign a path object to a std::string, you have to perform a character conversion from wchar_t to char. The path::string() method does that for you, eg:

    std::string s = i->string(); 
    

    Otherwise, use a std::wstring instead, which you can assign to using either the path::native() or path::wstring() method, eg:

    std::wstring s = i->native(); 
    
    std::wstring s = i->wstring(); 
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wrote a program out, which was all in one file, and the methods
I wrote a C program which reads a dataset from a file and then
I wrote a sh program which when you type in the argument which is
I wrote a program which includes writing and reading from database. When I run
I wrote a quick program which executes every statement before giving a seg fault
I wrote a test program to monitor my Picture folder which points to c:\users[username]\Pictures
I wrote a program about 10 years ago in Visual Basic 6 which was
I'm a little bit confused about simple program which I wrote, can You please
I am new to java programming. I have a program which I wrote to
I wrote a program that makes a reference to Microsoft.Web.Administration.dll, which is not present

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.