QString path("C:\\测试.txt"); ofstream o_file; #ifdef Q_OS_WIN32 o_file.open((wchar_t*)path.utf16(),ios::trunc); #endif o_file << "test" << endl; o_file.close();
ofstream open的时候,带有中文字就挂了,上面是解决方案,好像只能在win32中有效。
1231QString path("C:\\测试.txt"); ofstream o_file; #ifdef Q_OS_WIN32 o_file.open((wchar_t*)path.utf16(),ios::trunc); #endif o_file << "test" << endl; o_file.close();
ofstream open的时候,带有中文字就挂了,上面是解决方案,好像只能在win32中有效。
1231