Skip to content
Snippets Groups Projects
readcsv.cpp 463 B
Newer Older
#include <fstream>
#include <iostream>
#include <string>

using namespace std;

ifstream file ( "file.csv" ); // declare file stream: http://www.cplusplus.com/reference/iostream/ifstream/
string value;
while (file.good()){
     getline ( file, value, ';' ); // read a string until next comma: http://www.cplusplus.com/reference/string/getline/
     cout << string( value, 1, value.length()-2 ); // display value removing the first and the last character from it
}