Я хочу перебирать все файлы в каталоге, соответствующем «keyword.txt». Я искал какое-то решение в гугле и нашел это: Can I use a mask to iterate files in a directory with Boost?Итерация файлов с boost :: filesystem 3.0
Как я выяснил позже, в «лист()» функция была заменена (источник: http://www.boost.org/doc/libs/1_41_0/libs/filesystem/doc/index.htm -> Гото раздел «DEPRECATED имен и функции»)
что я получил до сих пор это, но это не работает. Извините за это как-то глупый вопрос, но я более или менее начинаю C++.
const std::string target_path("F:\\data\\");
const boost::regex my_filter("keyword.txt");
std::vector<std::string> all_matching_files;
boost::filesystem::directory_iterator end_itr; // Default ctor yields past-the-end
for(boost::filesystem::directory_iterator i(target_path); i != end_itr; ++i)
{
// Skip if not a file
if(!boost::filesystem::is_regular_file(i->status())) continue;
boost::smatch what;
// Skip if no match
if(!boost::regex_match(i->path().filename(), what, my_filter)) continue;
// File matches, store it
all_matching_files.push_back(i->path().filename());
}
Что сообщение об ошибке? – cpp