title: .get function with an opened file stream in C++
body: <p>I have an open input file stream. It is able to open the other file (a txt file) successfully. And by making adjustments to the code right below I can get it read and output the other txt file (all ASCII characters, just letters) just fine. However, I was playing around with the below function. This results in one line being read, when there are in fact three lines. I want to know <strong>why</strong>. The size of the array is not the problem, i.e., making it larger does not seem to fix anything. </p>
  
  <pre><code>void DispFile(fstream&amp; iFile)
  {
       auto char fileChar[256];
  
       while (inFile.get(fileChar,256))
             {                                 
  
              cout &lt;&lt; fileChar;
  
             }
  
  }
  </code></pre>
  
  <p>Here is the code that WORKS:</p>
  
  <pre><code>void DispFile(fstream&amp; iFile)
  {
     auto char fileChar[256];
  
  
     while (inFile.getline(fileChar,256))
     {
     cout &lt;&lt; fileChar;
     cout &lt;&lt; endl;
     }
  }
  </code></pre>
  
  <p>OR</p>
  
  <pre><code>void DispFile(fstream&amp; iFile)
  {
  
     char file;
  
     while (inFile.get(file)
     {
     cout &lt;&lt; file;
     }
  
  }
  </code></pre>
  
  <p>So why does using inFile.get(array, dimension) result in only one line being read, while the others work like a charm (so to speak).</p>