title: Why is stringstreams rdbuf() and str() giving me different output?
body: <p>I have this code,</p>
  
  <pre><code>int main()
  {
      std::string st;
      std::stringstream ss;
      ss&lt;&lt;"hej hej med dig"&lt;&lt;std::endl;
  
      std::getline(ss,st,' ');
      std::cout &lt;&lt;"ss.rdbuf()-&gt;str() : " &lt;&lt; ss.rdbuf()-&gt;str();
      std::cout &lt;&lt;"ss.rdbuf() : " &lt;&lt; ss.rdbuf();
      return 0;
  }
  </code></pre>
  
  <p>Giving me this output</p>
  
  <blockquote>
    <p>ss.rdbuf()->str() : hej hej med dig</p>
    
    <p>ss.rdbuf() : hej med dig</p>
  </blockquote>
  
  <p>But why is that? Is that because of ostreams definition of operator&lt;str() gives me different output. In my eyes the output should be the same even if I have used getline.</p>