c++ ofstream 解决中文路径问题

180it 2020-10-09 PM 2413℃ 0条

ofstream 解决中文路径问题

std::locale loc = std::locale::global(std::locale(""));
    ofstream testOFstream("C:\\测试.txt");
    if (testOFstream.is_open())
    {
        testOFstream<<"this is a test\n";
        testOFstream<<"this is another test";
        testOFstream.close();
    }
std::locale::global(std::locale(loc ));
支付宝打赏支付宝打赏 微信打赏微信打赏

如果文章或资源对您有帮助,欢迎打赏作者。一路走来,感谢有您!

标签: none

c++ ofstream 解决中文路径问题