//设置代码页为简体中文,936是简体中文的代码页。
std::locale loc1 = std::locale::global(std::locale(".936"));
//在这里使用 fstream、ifstream、ofstream
fstream binary_file(file_name ,ios::out|ios::binary|ios::trunc );
//恢复原来的代码页
std::locale::global(std::locale(loc1));
文件路径中文编码问题解决方案之一
最新推荐文章于 2023-07-01 08:15:00 发布