title: How to convert Wchar_t* to const char*
body: <p>I am a kind of new for c++ , while working on the windows CE .net compact application </p>
  
  <p>while trying to write hexa datas to a file </p>
  
  <pre><code>CString dataBlock1;
  dataBlock1 = "";
  
  CString temp;
  for(int i = 0; i &lt; rLen; i++)
  {
  temp.Format(L"%02X ",rec[i]);
  dataBlock1 += temp;
  
  }
  
  std::ofstream out(file);
  </code></pre>
  
  <p>I am getting this error can not convert parameter 1 from wchar * to const char* 
  on while using the below write function to write hexa datas to a file</p>
  
  <pre><code>out.write(myReader.dataBlock1.GetBuffer(),myReader.dataBlock1.GetLength());
  </code></pre>
  
  <p>how can we convert wchar_* to const char*  to make the write function work.</p>
  
  <p>Thanks.</p>