title: c++ change directory of ofstream with a string buffer filename
body: <p>I have this line of code</p>
  
  <pre><code>    std::ofstream output(p_strFilename.c_str());
  </code></pre>
  
  <p>where <code>p_strFilename</code> is defined from a function parameter</p>
  
  <pre><code>    foo(const std::string &amp;p_strFilename)
  </code></pre>
  
  <p>which is saving a bunch of files in the current working directory. However I want to enter a step inside that directory and save the files inside. I tried</p>
  
  <pre><code>    std::ofstream output("folder1\\"+p_strFilename.c_str())
  </code></pre>
  
  <p>this is giving me</p>
  
  <pre><code>    error: invalid operands of types ‘const char [9]’ and ‘const char*’ to binary ‘operator+’
  </code></pre>
  
  <p>which I guess is reading the directory as 9 characters instead of as a string.</p>
  
  <p>First question: Is that the right way to input a directory? (double backslash and starting from the CWD not form home directory)</p>
  
  <p>Second question: How can I resolve my compilation error?</p>