title: How do I tell a program where to start reading a .txt file?
body: <p>I want my program to be able to remember where it left off in a <code>.txt</code> file in order to proceed to the next input upon reiteration through a loop.
  For instance, a text file containing:</p>
  
  <pre><code>Apples
  Bananas
  Oranges
  </code></pre>
  
  <p>would be accessed through a function <code>GetItem()</code> that appends the next file input into a vector of items. How do I make the function add <code>Apples</code> the first time, <code>Bananas</code> the second time, and <code>Oranges</code> the third iteration? As of now, each call to <code>GetItem()</code> keeps adding the first element to the vector, giving a vector containing:</p>
  
  <pre><code>Apples
  Apples
  Apples
  </code></pre>
  
  <p>Because the file keeps opening from the beginning. Any help would be appreciated.</p>
  
  <p>This is a simplified version of lengthy amounts of code that I could include, but would distract from the main purpose of the question. If the code is needed, I would be happy to include it.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>vector&lt;Item*&gt; AddItemToInventory(vector&lt;Item*&gt; inventory) {
  if (inptLctn == 'f') {
          inptFile.open("TestFood.txt");
          if (!inptFile.is_open()) {
              cout &lt;&lt; "Could not open file." &lt;&lt; endl;
              exit(1);
              }
              inptFile &gt;&gt; usrInptName;
              inptFile &gt;&gt; usrInptQnty;
              inptFile &gt;&gt; usrInptExpr;
              inptFile &gt;&gt; usrInptPrice;
  
              }
  prdc = new Produce;
      prdc-&gt;SetName(usrInptName);
      prdc-&gt;SetQuantity(usrInptQnty);
      prdc-&gt;SetExpiration(usrInptExpr);
      prdc-&gt;SetPrice(usrInptPrice);
      inventory.push_back(prdc);
  
      return inventory;
  }</code></pre>
  </div>
  </div>
  </p>