void read (std::istream & _input) {
string linijka;
vector<string> entry;
string laaa, naa;
int ii=0;
while (getline(_input,linijka,'\n')) {
cout<<"current line:"<<linijka<<endl;
while(linijka[ii] != ',') {laaa+=linijka[ii]; ii++;}
entry.push_back(laaa);
ii++;
cout<<entry[0]<<endl;
laaa.clear();
while(linijka[ii] != '\n') {laaa+=linijka[ii]; ii++;}
entry.push_back(laaa);
//doing something with entry
ii=0;
laaa.clear();
linijka.clear();
entry.clear();
}
}
my csv file is:
34,879
78,098
i use this file to initialize read function
and in console i have sthg like that:
current line:34,879
current line:78,098
current line:
current line:
why on the earth i have two extras lines?? despite thera are only two lines in a file and 'while' should be done only twice????