title: How does one convert from CString to unsigned char* with Unicode?
body: <p>I'm trying to do something simple here. When I execute the following code in Visual Studio 2008 using the unicode character set, xmlString is correct. </p>
  
  <p>Unfortunately I need to convert the CString to a unsigned char*.
  Using the code below, ucStr becomes "&lt;" (i.e. the first character of xmlString).</p>
  
  <p><strong>How should I convert the CString to an unsigned char* and retain all the information?</strong></p>
  
  <pre><code>        CString xmlString;
          xmlString.Format( _T("&lt;?xml version=\"1.0\" encoding=\"ISO-8859-1\"?&gt;&lt;gateway&gt;&lt;config-read&gt;&lt;%s /&gt;&lt;/config-read&gt;&lt;/gateway&gt;"), keyName);
  
          unsigned char * ucStr = reinterpret_cast&lt;unsigned char *&gt; (xmlString.GetBuffer());
          pgIRequest-&gt;SendXmlData( "dgv/gateway.xml", ucStr, xmlString.GetLength() + 1) ; 
  </code></pre>