c++ reading csv file

Read the file line by line:

std::string line;
while(std::getline(stream, line)) ...

Pass each line to a istingstream and read the fields:

std::istringstream s(line);
std::string field;
while (getline(s, field,',')) ...

Disclaimer: This is a simplified parsing of a csv-file.

Leave a Comment