title: C++ : getline() function does not include last character/string when reading from a file
body: <p>i have these words from a textfile each separated by a '\t' space.</p>
  
  <p>I want to be able to print those words in separate lines</p>
  
  <p>For example:
  these are the words from the textfile:</p>
  
  <pre><code>hel lo    im    carlos 
  </code></pre>
  
  <p>The result i want:</p>
  
  <pre><code>hel lo  
  im
  carlos
  </code></pre>
  
  <p>The result i'm getting:</p>
  
  <pre><code>hel lo 
  im
  </code></pre>
  
  <p>here's the code:</p>
  
  <pre><code>string ReadString(ifstream &amp;file){
      char buf[1024];
      file.getline(&amp;(buf[0]), 1024, '\t');
      return string(buf);
  }
  
  main(){
      ifstream delimfile("new.txt");
      while(1){
          string words = ReadString(delimfile);
          if(delimfile.eof()==true)
              break;
          cout &lt;&lt; words &lt;&lt; endl;
      }
      delimfile.close();
  }
  </code></pre>
  
  <p>all the help is appreciated</p>