For some reason the getline function is not returning all of a line for me. Here are the first three lines of my input file, it is from the kaggle Titanic competition training data:
1 2 3
PassengerId,Survived,Pclass,Name,Sex,Age,SibSp,Parch,Ticket,Fare,Cabin,Embarked
1,0,3,"Braund, Mr. Owen Harris",male,22,1,0,A/5 21171,7.25,,S
2,1,1,"Cumings, Mrs. John Bradley (Florence Briggs Thayer)",female,38,1,0,PC 17599,71.2833,C85,C
I think the input file uses \r\n for new lines. When it gets to the second line, the value of 'line' is "1,0,3,\", immediately after getline has been called, meaning that it stopped when it reached the first quote, despite my having explicitly told it to stop at \r.
The first line does not have a quote in it, so I don't understand how the splitCSV method could have somehow caused this problem. For learning purposes I decided to write my own splitCSV method instead of using boost.
Can somebody please tell me what I'm doing wrong here?