title: Continuously input lines using getline to end of txt document C++
body: <p>I have a really long .txt file which I want to stream in using <code>getline</code>. I want to input this entire text document, and then run it through a procedure.</p>
  
  <p>I then want to run that new string through the same procedure using a different values, and so on 2 more times. </p>
  
  <p>So far I have</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  #include &lt;string&gt;
  
  using namespace std;
  
  void flag(string &amp; line, int len);
  void cut(string &amp; line, int numb);
  
  int main()
  {
      string flow;
      ifstream input;
      ofstream output;
      input.open(filename.c_str()); //filename ...
  
      output.open("flow.txt");
  
      while (!input.fail())
          getline(input, flow);
      flag(flow, 10);
      flag(flow, 20);
      cut(flow, 20);
      cut(flow, 3);
  
      output &lt;&lt; flow;
  
      return 10;
  }
  //procedures are defined below.
  </code></pre>
  
  <p>I am having troubles running the entire file through a procedure. How would I stream this in, using <code>getline</code>.</p>
  
  <p>I have tried <code>getline</code>, <code>infile.fail</code>, <code>npos</code>, etc.</p>