title: Convert wstring to const *char in c++
body: <p>I have got a wstring and I want to convert it to const char in order to write it with the write function of fstream library. What I tried to do is the following:</p>
  
  <pre><code>std::ofstream out("test.txt", std::ios::out | std::ios::app | std::ios::binary);
  char mbstr[11];
  std::wcstombs(mbstr, strValue.c_str(), 11); //strValue my wstring
  out.write(mbstr, 11);
  ... // i have got another four wstring.
  </code></pre>
  
  <p>I am not sure what I did, however the result is a text file is weird:</p>
  
  <pre><code>0.100693 ÌÌ0.000000 ÌÌ0.004094 ÌÌ0.360069 ÌÌ0.086034 
  </code></pre>
  
  <p>Any idea how can I write properly my wstring in the file?</p>