M
M
Makaleks2013-12-26 21:55:34
C++ / C#
Makaleks, 2013-12-26 21:55:34

Boost filename to char string

Yes:
<boost\filesystem.hpp>
To search for files (current directory) I dug up the code:

for (boost::filesystem::recursive_directory_iterator it("./"), end; it != end; ++it) {
        if (it->path().extension() == ".txt") {
            std::cout << *it << std::endl;
        }
}

Question:
   How to assign a file name to a char string (generally, unsigned, but not important)?
      (yes, that ".txt")
(Add.)
Why coutis it enough to feed *it? In principle, I'm interested in what exactly he extracts
PS

После подходящего решения приму любую информацию по работе этого recursive_directory_iterator

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
bak, 2013-12-27
@Makaleks

1) it->path().string()returns std::string, which is casted to char*through c_str()
2) *itreturns path, for pathoperator overloaded<<

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question