title: Parse int to string with stringstream
body: <p>Well!</p>
  
  <p>I feel really stupid for this question, and I wholly don't mind if I get downvoted for this, but I guess I wouldn't be posting this if I had not at least made an earnest attempt at looking for the solution.</p>
  
  <p>I'm currently working on Euler Problem 4, finding the largest palindromic number of two three-digit numbers [100..999]. </p>
  
  <p>As you might guess, I'm at the part where I have to work with the integer I made. I looked up a few sites and saw a few standards for converting an Int to a String, one of which included stringstream.</p>
  
  <p>So my code looked like this:</p>
  
  <pre><code>//  tempTotal is my int value I want converted.
  void toString( int tempTotal, string &amp;str )
  { 
      ostringstream ss;            // C++ Standard compliant method.
      ss &lt;&lt; tempTotal;
      str = ss.str();              // Overwrite referenced value of given string.
  }
  </code></pre>
  
  <p>and the function calling it was:</p>
  
  <pre><code>else
  {
      toString( tempTotal, store );
      cout &lt;&lt; loop1 &lt;&lt; " x " &lt;&lt; loop2 &lt;&lt; "= " &lt;&lt; store &lt;&lt; endl; 
  }
  </code></pre>
  
  <p>So far, so good. I can't really see an error in what I've written, but the output gives me the address to something. It stays constant, so I don't really know what the program is doing there. </p>
  
  <p>Secondly, I tried .ToString(), string.valueOf( tempTotal ), (string)tempTotal, or simply store = temptotal.</p>
  
  <p>All refused to work. When I simply tried doing an implicit cast with store = tempTotal, it didn't give me a value at all. When I tried checking output it literally printed nothing. I don't know if anything was copied into my string that simply isn't a printable character, or if the compiler just ignored it. I really don't know.</p>
  
  <p>So even though I feel this is a really, really lame question, I just have to ask:</p>
  
  <p>How do I convert that stupid integer to a string with the stringstream? The other tries are more or less irrelevant for me, I just really want to know why my stringstream solution isn't working. </p>
  
  <h2>EDIT:</h2>
  
  <p>Wow. Seriously. This is kind of embarrassing. I forgot to set my tempTotal variable to something. It was uninitialized, so therefore I couldn't copy anything and the reason the program gave me either a 0 or nothing at all.</p>
  
  <p>Hope people can have a laugh though, so I think this question would now be better suited for deletion since it doesn't really serve a purpose unless xD But thanks to everybody who tried to help me! </p>