Getline repeats the same line

I'm building a quick sanitizer to strip out unnecessary columns from CSV data before I port it to another piece of software. I'm getting good parsing of the string and such, but my getline seems stuck - no matter how many times the loop iterates, it returns the same one line of the file it's reading, rather than moving on.

Here is the relevant loop:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
while(fin.good())
{
  string temp;
  getline(fin, temp);
		
  Tokenize(temp, cells, ",");
		
  for (int i = 0; i < cells.size(); i++)
  {
    if (i == 1 || (5 <= i && i <= 9)) //ignores the cells I don't need
      fout << cells[i] << "\t";
  }
  fout << endl;
}


Output (example purposes, not my real data):
project1 Jack Brown $235
project1 Jack Brown $235
project1 Jack Brown $235
project1 Jack Brown $235
project1 Jack Brown $235
project1 Jack Brown $235

Instead of the different projects, names, etc. that are in the file.

Any suggestions?
Is cells passed to Toeknize by value or by reference? And why is cells defined outside of the while loop?
Topic archived. No new replies allowed.