大问题!大问题!小毛病
xomae 2007-05-23 04:36:03 用什么函数能把TXT文件的内容读出来,具体代码怎么写
我用CFile 但是读出来最后会出现空格符号和乱吗
程序如下
void CMathDoc::OnOpen()
{
// TODO: Add your command handler code here
CFileDialog Open_dlg( false, _T(".txt"), 0, OFN_FILEMUSTEXIST,
_T("TXT Files (*.*)|*.*|"), NULL );
if(! Open_dlg.DoModal()==IDOK )
{
return;
}
CFile mFile;
if (mFile.Open(Open_dlg.GetPathName(),CFile::modeRead | CFile::typeBinary))
{
CString Mes;
long FileLeng=mFile.GetLength();
Mes.Format("Size:%d",FileLeng);
AfxMessageBox(Mes);
ReadChar=new char[FileLeng];
mFile.Read(ReadChar,FileLeng);
}
MathCode Mathcodedlg;
Mathcodedlg.m_ArithSerial=ReadChar;
Mathcodedlg.DoModal();
}