I've written this little member function to parse a vector's data, but it only parses the first LINE of data.
See, the vector reads in a multi-line file, each line with 3 parameters separated by a semi-colon.
The vector has all that unparsed data stored, so what this function does is read through it, and parse the data, placing the right segment of data in the correct array. My problem is my function doesn't seem to be iterating through the entire vector. ONLY the first line of the file that's stored in the vector is parsed (which I've checked and double checked by outputting the arrays the data is sent to, and outputting the data as it's parsed).
I am a bit rusty, and I'm confused as to why it's not running through the entire vector, as it seems to me that it should. Code below is the function:
Code:
void Map::parse_data()
{
  istringstream iss;
  string parsed;
  vector<string>::iterator iter;
  int counter=0;
  for(iter=data.begin();iter!=data.end();iter++)
    {
      iss.str((*iter));
      while(!iss.eof())
	{
	  getline(iss,parsed,';');
	  if(!parsed.empty())
	    switch(counter)
	      {
	      case 0:
		xsprcrds[xpos]=atoi(parsed.c_str());
		parsed.clear();
		xpos++;
		counter++;
		break;
	      case 1:
		ysprcrds[ypos]=atoi(parsed.c_str());
		parsed.clear();
		ypos++;
		counter++;
		break;
	      case 2:
		sprname[npos]=parsed;
		parsed.clear();
		npos++;
		counter=0;
		break;
	      }
	}
    }
}
Any help's appreciated, thanks.