title: C++ WCHAR manipulations
body: <p>I'm developing a tiny Win32 app in C++.
  I've studied C++ fundamentals long time ago, so now I completely confused because  of character strings in C++. There were no <code>WCHAR</code> or <code>TCHAR</code> only <code>char</code> and <code>String</code>.
  After a little investigation I've decided not to use <code>TCHAR</code>.</p>
  
  <p>My issue is very simple I think, but I can't find clear guide how to manipulate strings in C++. Affected by PHP coding last few years I've expected something simple with strings manipulations and was wrong!</p>
  
  <p>Simply, all I need is to put new data to a character string.</p>
  
  <pre><code>    WCHAR* cs = L"\0";
      swprintf( cs, "NEW DATA" );
  </code></pre>
  
  <p>This was my first attempt. When debugging my app I've investigated that swprintf puts only first 2 chars to my cs var. I've resolved my problem this way:</p>
  
  <pre><code>    WCHAR cs[1000];
      swprintf( cs, "NEW DATA" );
  </code></pre>
  
  <p>But generally this trick could fail, because in my case new data is not constant value but another variable, that could potentialy be wider, than 1000 chars long. And my code is looks like this:</p>
  
  <pre><code>    WCHAR cs[1000];
      WCHAR* nd1;
      WCHAR* nd2;
      wcscpy(nd1, L"Some value");
      wcscpy(nd2, L"Another value"); // Actually these vars stores the path for user selected folder
      swprintf( cs, "The paths are %s and %s", nd1, nd2);
  </code></pre>
  
  <p>In this case there is possibility than nd1 and nd2 total character count could be greater than 1000 chars so critical data will be lost.</p>
  
  <p>The question is how can I copy all data I need to WCHAR string declared this way <code>WCHAR* wchar_var;</code> without losing anything?</p>
  
  <p>P.S. Since I'm Russian the question may be unclear. Let me now about that, and I'll try to explain my issue more clear and complex.</p>