A C++ header-only CSV parser with an interface inspired by Python's DictReader/DictWriter.
Install csv using Homebrew.
brew tap ryangraham/csv
brew install csv
std::string input_file_name = "../input.csv";
std::fstream ifs(input_file_name);
if (!ifs) return 1;
auto reader = csv::map_reader(ifs);
std::cout << reader.field_names.front() << std::endl;
std::cout << std::string(10, '-') << std::endl;
for (auto& row : reader.rows()) {
std::cout << row["FirstName"] << std::endl;
}
Will output something like...
FirstName
----------
Fred
Pebbles
Barney
Betty
See examples.