title: how can I convert wstring to u16string?
body: <p>I want to convert <code>wstring</code> to <code>u16string</code> in C++.</p>
  
  <p>I can convert <code>wstring</code> to string, or reverse. But I don't know how convert to <code>u16string</code>.</p>
  
  <pre><code>u16string CTextConverter::convertWstring2U16(wstring str)
  
  {
  
          int iSize;
          u16string szDest[256] = {};
          memset(szDest, 0, 256);
          iSize = WideCharToMultiByte(CP_UTF8, NULL, str.c_str(), -1, NULL, 0,0,0);
  
          WideCharToMultiByte(CP_UTF8, NULL, str.c_str(), -1, szDest, iSize,0,0);
          u16string s16 = szDest;
          return s16;
  }
  </code></pre>
  
  <p>Error in WideCharToMultiByte(CP_UTF8, NULL, str.c_str(), -1, szDest, iSize,0,0);'s <code>szDest</code>. Cause of <code>u16string</code> can't use with <code>LPSTR</code>.</p>
  
  <p>How can I fix this code?</p>