title: How to do string operations with Win32 WCHAR
body: <p>I have a win32 project in which I'm trying to edit the characters of a WCHAR string with a custom function.</p>
  
  <p>I know this stands for Wide Char and is Unicode, however I don't fully grasp how the encoding works. For example, I know UTF-8 also holds Unicode, but is it the same as a WCHAR?</p>
  
  <p>I assumed the string would look something like</p>
  
  <pre><code>00 43 00 4f 00 44 00 45 00 00
      C     O     D     E    \0
  </code></pre>
  
  <p>And for copying it works fine to just assume the string is twice as long. However I am getting errors when, say, searching for a character, for example:</p>
  
  <pre><code>for(int i = wcslen(inStr) - 2; i &gt;= 0; i--) {
      WCHAR current[] = {inStr[i], inStr[i + 1], 0, 0};
      if(current == _T("/")) {
          pos = i;
          break;
      }
  }
  </code></pre>
  
  <p>Produces some corrupted errors. Am I making this too complicated? I understand there's probably many functions to do this, but I'd like to understand how it works, so I can make for efficient code. Thanks</p>