Reading data from file

I have been given some code for an assignment and i am having a problem reading in data from a file. A class has been given to us that is supposed to read this file and put the data line by line into a vector, however when i try to print the contents of this vector it says there is nothing in the vector.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
  void SetCollection::initialize(Scanner& scanner)
{
  string inputLine = "";

  ScanLine scanLine;
  MySet mySet;

#ifdef EBUG
  Utils::logStream << "enter initialize\n";
#endif

  // read the first line and split into tokens in a 'vector'
  while (scanner.hasNext())
  {
    inputLine = scanner.nextLine();
    scanLine.openString(inputLine);

    MySet localSet;
    while (scanLine.hasNext())
    {
      string elt = scanLine.next();
      localSet.add(elt);
    }
    //cout << "SET " << localSet.toString() << endl;
    this->myCollection.push_back(localSet);
  }

#ifdef EBUG
  vector<set<string> >::iterator iter;
  for(iter = this->myCollection.begin();
          iter != this->myCollection.end(); ++iter)
  {
    cout << "INIT " << (iter->second).toString() << "\n";
  }

  Utils::logStream << "leave initialize\n";
#endif
}


The file that contains the data looks like this:
1
2
3
4
5
6
7
a b c d
b e
a b e f g
b e
b c d
u
f f g h i


Does anyone see what is not working? It seems to make sense to me but i do not know why the data is not being put into the vector.
Topic archived. No new replies allowed.