这段程序为什么出现乱码呢?怎样才能改动最小而消除乱码呢?
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
char war[50],hao[50];
ofstream offile("wjj.txt");
cout << "输入书名 : ";
cin.get(war,50,'\n');
offile.write((char*)&war,sizeof(char));
offile.close();
ifstream iffile("wjj.txt");
iffile.seekg(1,ios::beg);
iffile.read((char*)&hao,sizeof(char));
cout <<"\n"<<"shu_ming"<< hao <<endl;
return 0;
}