This post is also available in: Deutsch (German)
This minimal example reads a file line-by-line using std::getline
and prints out each line on stdout
.
#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 Your code goes here. This is just an example! cout << line << endl; } fin.close(); }