Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
28 lines (22 sloc) 499 Bytes
/* csvstream_example1.cpp
*
* Andrew DeOrio <awdeorio@umich.edu>
*
* An easy-to-use CSV file parser for C++
* https://github.com/awdeorio/csvstream
*/
#include "csvstream.h"
#include <iostream>
#include <string>
#include <map>
using namespace std;
int main() {
// Open file
csvstream csvin("input.csv");
// Rows have key = column name, value = cell datum
map<string, string> row;
// Extract the "animal" column
while (csvin >> row) {
cout << row["animal"] << "\n";
}
}
You can’t perform that action at this time.