I writing a txt file using ofstream, from various reasons the file should have local encoding and not UTF8.
The machine which process the file has different localizations then the target local.
is there a way to force the encoding when writing a file?
regards,
Ilan
You can call
std::ios::imbueon yourofstreamobject to modify the locale. This won’t affect the global locale.Pay attention to the argument of
std::localeconstructor, it is implementation dependant. For example, the German locale could be :or