mfc文件输出乱码
在vs2008环境下,
void CFileView::OnFileWrite()
{
// TODO: 在此添加命令处理程序代码
FILE *pFile=fopen("1.txt","w");
fwrite("http://www.sunxin.org",1,strlen("http://www.sunxin.org"),pFile);
fclose(pFile);
}
void CFileView::OnFileRead()
{
// TODO: 在此添加命令处理程序代码
FILE *pFile=fopen("1.txt","r");
char *pBuf;
fseek(pFile,0,SEEK_END);
int len=ftell(pFile);
pBuf=new char[len+1];
fread(pBuf,1,len,pFile);
pBuf[len]=0;
fclose(pFile);
MessageBox(pBuf);
}
messagebox输出的怎么是汉字乱码呢?如何修改?