I want to read csv file by using c++ so here is my code
int main(){
ifstream classFile("class.csv");
vector<string> classData;
while (getline(classFile, line,',')) // there is input overload classfile
{
classData.push_back(line);
}
}
here is my question : my problem is when it reads the last column of each row (since it is not separated by comma) it reads last column data and first of next row data for example if my data was like
className, classLocation, Professor c++, Library, John
then it reads like className/ classLocation/ Professor c++/ Library / John
is there anyway that I can separate my last column from first of next row? Thank you and sorry that it is confusing