title: C++ File Parser/stdin input - Will This Algorithm Work?
body: <p>I'm trying to implement a line scan conversion in OpenGL from stdin that lists line end points like so:</p>
  
  <pre><code>L 0, 0, 150, 150
  L -20, 40, 22, 55
  [...]
  Z
  </code></pre>
  
  <p>Where the [...] is just more of the same, and the Z character is a convenient termination operator, though end of file may also work.</p>
  
  <p>Given that I want to output these lines in OpenGL, is it best to first store them to an array, or read in and display all in one go? My thought is to try something like this (kinda psuedocoded):</p>
  
  <pre><code>bool loadData(int[] lines, string fileName) {
  
  ifstream inputFile;
  inputFile.open("fileName.txt");
  
  if (!inputFile.is_open()) {
      return false;
  }
  
  if (inputFile.is_open()) {
      while (getline(fileName, i, ',')) {
          //Write to lines array
      }
  
  }
  inputFile.close();
  }
  </code></pre>
  
  <p>However, I'm not sure how to extend support for Z termination, or how to accept console/stdin input as well. Can my algorithm be extended handle both files and console simply, or am I better off dividing up the approach?</p>