title: Having Difficulty Reading Data From a File in C++
body: <p>I'm having some trouble with this project for school and could use some help getting started. I'm given a file that contains movie titles, the year they were made, and their genres then I'm supposed to create a linked list with the information. Each line in the file looks something like this: </p>
  
  <p><code>1::Toy Story (1995)::Animation|Children's|Comedy</code> </p>
  
  <p>If the user decides to search by the movie title and enters <code>Toy Story</code>, it should display both the name and year of the movie: <code>Toy Story (1995)</code> If the user decides to search by genre it should display every movie that contains the genre. Lastly, if the user wants to remove a movie, they enter the movie title and it should be deleted from the linked list along with its other information.</p>
  
  <p>So the problem I'm having so far is reading in the data. When I read in the data I am able to remove the <code>::</code> and <code>|</code> and store everything in a vector but now each element of the vector is one word, meaning that if I were to print out <code>vect[1]</code> for example it would be <code>Toy</code> (since <code>vect[0]</code> would be <code>1</code> as I don't know how to remove the leading numbers which is another problem).</p>
  
  <p>So how would I go about keeping the title of the movie together so I can add it to a linked list and vice versa for the genres and years?  Also, will I need to create three linked lists, one being the movie titles, one being the years and the other being the genres?</p>
  
  <p>I don't have much code, since my problem is right at the beginning but this is what I have so far. It goes through the file and removes the <code>::</code> and <code>|</code> and stores it into a vector. I don't know how I should precede from here or even if this would be the correct way to start for this type of problem.</p>
  
  <pre><code>   while(inFile &gt;&gt; value)
     {
         istringstream iss(value);
         string line;
  
         while(getline(iss, line))
         {
             size_t prev = 0, pos;
             while ((pos = line.find_first_of("|:", prev)) != string::npos)
             {
                 if (pos &gt; prev)
                 {
                     vect.push_back(line.substr(prev, pos-prev));
                 }
                 prev = pos + 1;
             }
             if (prev &lt; line.length())
             {
                  vect.push_back(line.substr(prev, string::npos));
             }
         }
      }
  </code></pre>
  
  <p>I'm not one to usually ask for help but I'm completely stuck and have no idea how to continue. Any help would be appreciated! If I need to clarify anything let me know. </p>