Well, given that it's Windows, you'd not have UTF8 anyway. But exactly what are you writing? Usually, you have a std::string
in memory and write that to disk. The only difference is that \n
in memory is translated to CR/LF (\r\n
) on disk. That's the same translation everywhere.
You might encounter a situation where you're writing a std::wstring
. In that case, it's determined by the locale. The default locale is the C locale, aka std::locale("C") or
std::locale::classic(). The local encoding (which you seem to want) is
std::locale("")`.
Other locales exist; see here