Write data to file

Code:

ofstream outfile("path/to/file/filename.x");
outfile.imbue(locale("en_US.UTF8")); // for mac remove this line
outfile << "test";
outfile.close();

This part of the code works perfectly on the Windows platform. But it does not work on the Mac Os platform. Tell me what I don’t understand and what I’m doing wrong. The compiler does not give any problems/errors. I will be glad to receive any hints. Thanks.