I am following the solution code by Loki Astari on
How can I read and parse CSV files in C++?
How can i write an iterator in the main function to count the number of columns from CSV header
int main()
{
std::ifstream file("plop.csv");
for(CSVIterator loop(file); loop != CSVIterator(); ++loop)
{
//Instead of printing the 4th element as shown below, I want to print all the
//columns and thus determine the number of columns
//std::cout << "4th Element(" << (*loop)[3] << ")\n";
}
}
Here is an example header of a csv file I am working with
cmd, id, addr, qos, len, lock, prot, burst, size, cache, user, duser, dstrb, data
I want to print them using an iterator or some for loop and determine the number of columns which in this case is 14