C++: Datei zeilenweise lesen – minimales Beispiel
English
Deutsch
Dieses minimale Beispiel liest eine Datei zeilenweise mit std::getline und gibt jede Zeile auf stdout aus.
read_file_line_by_line.cpp
#include <fstream>
#include <iostream>
#include <string>
using namespace std;
int main(int argc, char** argv) {
ifstream fin("test.tsv");
string line;
while (getline(fin, line)) {
// TODO Ihr Code kommt hier rein. Dies ist nur ein Beispiel!
cout << line << endl;
}
fin.close();
}Check out similar posts by category:
C/C++
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow