title: replacing snprintf with c++ strings
body: <p>I have a requirement to replace C char buffers using <code>snprintf</code> with <code>std::string</code> and perform the same operation on them. I am forbidden from using <code>stringstream</code> or <code>boost</code> library.</p>
  
  <p>Is there a way to do it?</p>
  
  <pre><code>const char *sz="my age is";
  std::string s;
  s=sz;
  s+=100;
  printf(" %s \n",s.c_str());
  </code></pre>
  
  <p>I get the output as <br></p>
  
  <pre><code>my age is d 
  </code></pre>
  
  <p>where as required output is: <br></p>
  
  <pre><code>my age is 100
  </code></pre>