MFC中写入文件,文本文档应该写入汉字,但实际上写入的是十六进制数,求大家帮忙看看这是为什么?
const char COPYINFOLIBNAME[] = "copybook.txt";
int count = 0;
int i = 0;
Book book;
ofstream OUTFILE(COPYINFOLIBNAME);
if (OUTFILE)
{
for (i = 0;i< m_bookset->ListLength_B(); i++)
{
CBookSet::iterator it;
m_bookset->GetElem_B(i, book);
it = find(m_bookset->begin(), m_bookset->end(), book);
OUTFILE << *it;
count++;
}
OUTFILE.close();
AfxMessageBox(_T("备份成功!"));
}
else AfxMessageBox(_T("备份失败!"));