title: Write a unicode CString to a file using WriteFile API
body: <p>How can I write contents of a CString instance to a file opened by CreateFile using WriteFile Win32 API function?</p>
  
  <p>Please note MFC is not used, and CString is used by including "atlstr.h" </p>
  
  <p>edit: Can just I do </p>
  
  <pre><code>WriteFile(handle, cstr, cstr.GetLength(), &amp;dwWritten, NULL); 
  </code></pre>
  
  <p>or</p>
  
  <pre><code>WriteFile(handle, cstr, cstr.GetLength() * sizeof(TCHAR), &amp;dwWritten, NULL); 
  </code></pre>
  
  <p>?</p>