title: Difference between strstream and stringstream
body: <p>I was going through these two class implementations and found out that the <code>strstream</code> class is deprecated.</p>
  
  <p>And if I use the <code>stringstream</code> class as replacement, then there is big difference between how they log in the buffer since the <code>stringstream</code> class object maintains a deep copy of the buffer.</p>
  
  <p>Has anyone faced any problem while replacing <code>strstream</code> with <code>stringstream</code> class?</p>
  
  <p>What would be the output of this code and why?</p>
  
  <pre><code>#include&lt;iostream&gt;
  #include &lt;sstream&gt;
  #include &lt;strstream&gt;
  
  
  
  int main(){
  
      char strArr[] = "Soheb Khan is great";
  
      char stringArr[] = "TurboCharging";
  
      std::strstream strStream(strArr,19);
  
      std::stringstream stringStream(std::string(stringArr,19));
  
      std::cout&lt;&lt;"Before Modification strArr= "&lt;&lt;strArr&lt;&lt;" &amp; stringArr= "&lt;&lt;stringArr&lt;&lt;std::endl;
  
      strStream &lt;&lt; "Fifa 2012 is nice";
  
  
      stringStream &lt;&lt; "Sometimes its sucks";
  
  
      std::cout&lt;&lt;"After Modification strArr= "&lt;&lt;strArr&lt;&lt;" &amp; stringArr= "&lt;&lt;stringArr&lt;&lt;std::endl;
  
      return 0;
  
  
  }
  </code></pre>