title: How to create a Unicode txt file in C++
body: <p>There are four kind of encoding options when creating a .txt file in Windows. </p>
  
  <ul>
  <li>ANSI</li>
  <li>UNICODE(litte endian)</li>
  <li>UNICODE(big endian)</li>
  <li>UTF-8</li>
  </ul>
  
  <p><a href="https://i.stack.imgur.com/X4Olt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/X4Olt.png" alt="Text File Encoding Option"></a></p>
  
  <p>C standard library supports this option, by using <code>FILE</code>.</p>
  
  <p><a href="https://i.stack.imgur.com/lr2wa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lr2wa.png" alt="C STL"></a></p>
  
  <pre><code>FILE* file;
  file = _wfopen(L"test.txt", L"wt+,ccs=UTF-16LE");
  </code></pre>
  
  <p>It has been working great, but I found there is no parameter for this in <code>std::ofstream</code>.</p>
  
  <pre><code>wofstream myfile;
  myfile.open("example.txt", ?????????);
  </code></pre>
  
  <p>So, I want to know how to create files like this in C++. Is there any solution for this in C++ STL? </p>