我写了个程序,是以二进制写入,但打开文件却发现不是乱码#include<string>#include<fstream>using namespace std;int main(){string str;getline(cin,str);//输入ofstream fout("a.dat",ios::binary);fout.write(str.c_str(),str.size());fout.close();return 0;}