title: Concatenate char arrays in C++
body: <p>I have the following code and would like to end up with a char such as: "Hello, how are you?" (this is just an example of what I'm trying to achieve)</p>
  
  <p>How can I concatenate the 2 char arrays plus adding the "," in the middle and the "you?" at the end?</p>
  
  <p>So far this concatenates the 2 arrays but not sure how to add the additional characters to my final char variable I want to come up with.</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      char foo[] = { "hello" };
      char test[] = { "how are" };
      strncat_s(foo, test, 12);
      cout &lt;&lt; foo;
      return 0;
  }
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>This is what I came up with after all your replies. I'd like to know if this is the best approach?</p>
  
  <pre><code>#include "stdafx.h"
  #include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  int _tmain(int argc, _TCHAR* argv[])
  {
      char foo[] = { "hola" };
      char test[] = { "test" };
      string foos, tests;
      foos = string(foo);
      tests = string(test);
      string concat = foos + "  " + tests;
      cout &lt;&lt; concat;
      return 0;
  }
  </code></pre>