title: conversion to string with std::stringstream fails on white spaces
body: <p>I am trying to convert any string or character or number to <code>std::string</code> with <code>std::stringstream</code>. This is what I am doing:</p>
  
  <pre><code>template&lt;typename T&gt;
  std::string toString(T a){
      std::string s;
      std::stringstream ss;
      ss &lt;&lt;a;
      ss &gt;&gt;s;
      return s;
      }
  
  int main(int argc, char* argv[]) {
      char s[100]="I am a string with spaces";
      std::cout&lt;&lt;toString(s);
  
      return 0;
  } 
  </code></pre>
  
  <p>But it fails on the first white space.</p>
  
  <p>Output:</p>
  
  <pre><code>I
  </code></pre>
  
  <p>Expected Ouput:</p>
  
  <pre><code>I am a string with spaces
  </code></pre>
  
  <p>How can I do this.</p>
  
  <p>Note: <code>s</code> can contain newline character too.</p>