Manipulating Underlying string object using stringstream
<p>I am new to C++ and still juggling with stringstream.
I have written a small piece of code which doesn't give required output
The code is as follows:</p>

<pre><code>#include "iostream"
#include "sstream"

using namespace std;
int main ()
{
   string xyz;
   cout &lt;&lt; "Initial xyz : " &lt;&lt; xyz &lt;&lt; endl;
   stringstream s1 ( xyz );
   s1 &lt;&lt; "Hello";
   cout &lt;&lt; "Final xyz : " &lt;&lt; xyz &lt;&lt; endl;
}
</code></pre>

<p>Output:</p>

<pre><code>Initial xyz : 
Final xyz : 
</code></pre>

<p>My understanding is stringstream works as a wrapper around a string object.Therefore once stringstream has been initialized with a string object, any write operation on the stream will affect the underlying string object.So when I write "Hello" to stream and print the string xyz, it should display "Hello". But this clearly does not seem to be the case.
Can someone please tell me where am I wrong and how can I manipulate the underlying string using stringstream?
Thanks in advance !
Vimal</p>
