Ich versuche, den Inhalt mehrerer Dateien mit der Boost-Bibliothek zu lesen. Ich habe es gelungen, alle Dateien in einem Ordner zur Liste, aber ich stecke zu versuchen, sie zu lesen ...Mehrere Dateien lesen C++ mit Boost
#include <iostream>
#include "boost/filesystem.hpp"
using namespace std;
using namespace boost::filesystem;
int main(int argc, char* argv[])
{
// list all files in current directory.
// You could put any file path in here, e.g. "/home/me/mwah" to list that
// directory
path p("/home/baptiste/Bureau");
directory_iterator end_itr;
// cycle through the directory
for (directory_iterator itr(p); itr != end_itr; ++itr)
{
// If it's not a directory, list it. If you want to list directories too,
// just remove this check.
if (is_regular_file(itr->path()))
{
// assign current file name to current_file and echo it out to the
// console.
string current_file = itr->path().string();
cout << current_file << endl;
}
}
}
Suche nach 'fstream' und es ist Herleitungen (Datei-Streams) ... – Nim