I need to read from CSV: ISBN,title,author,genre,year published and I used Mockaroo.com to generate it. Second line looks like this:
289244243-5,"Eye of Vichy`,` The (Oeil de Vichy, L')",Nels Janoschek,Documentary,1943
and as you can see that highlighted comma is the problem because my function reads up to comma and sets values:
while(getline(excel_file, word, ',')){
book.set_isbn(word);
getline(excel_file, word, ',');
book.set_title(word);
getline(excel_file, word, ',');
book.set_author(word);
getline(excel_file, word, ',');
book.set_genre(word);
getline(excel_file, word, '\n');
book.set_year_published(word);
}
I noticed that those commas that shouldn't be included have space after , , meanwhile commas that should cause stoppage of getline() are followed by letter.
So I want to know if there is some way to exclude , (comma space) to cause getline() to stop reading?