title: How to convert an std::string to C-style string
body: <p>I am programming in C++.</p>
  
  <p>As basic as this question is I cannot seem to find an answer for it anywhere. So here is the problem:</p>
  
  <p>I want to create a C-style string however I want to put an integer variable i into the string. So naturally, I used a stream:</p>
  
  <pre><code>stringstream foo;
  foo
                  &lt;&lt; "blah blah blah blah... i = " 
                  &lt;&lt; i
                  &lt;&lt; " blah blah... ";
  </code></pre>
  
  <p>However, I need to somehow get a C-style string to pass to a function (turns out foo.str() returns an std::string). So this is technically a three part question -- </p>
  
  <p>1) How do I convert std::string to a C-style string?</p>
  
  <p>2) Is there a way to get a C-style string from a stringstream?</p>
  
  <p>3) Is there a way to use a C-style string directly (without using stringstreams) to construct a string with an integer variable in it?</p>