title: C++ create string of text and variables
body: <p>I'm trying to do something very simple and yet, after an hour of so of searching a I can't find a suitable answer so I must be missing something fairly obvious.</p>
  
  <p>I'm trying to dynamically create filenames for use with ifstream. Whilst I understand various methods are available of doing this, I have settled on creating a std::string, and the using stringname.c_str to convert to const.</p>
  
  <p>The problem is however that I need to create the string with a mix of variables and predefined text values. I'm getting compiler errors, so this must be a syntax issue.</p>
  
  <p>Pseudo </p>
  
  <pre><code>std::string var = "sometext" + somevar + "sometext" + somevar;
  </code></pre>
  
  <p>Thanks!</p>