逐行
/*
CStdioFile sfile;
if(!sfile.Open(dlg2.m_szFilepath,CFile::modeRead))
{
AfxMessageBox("Open file error!");
return;
}
CString strText="" ;
CString szLine ;
while( sfile.ReadString( szLine ) )
{
strText += szLine + "/r/n";
}
m_editFileContent.SetWindowText(strText);
sfile.Close();
*/
显示,不断行
CFile file;
if(!file.Open(dlg2.m_szFilepath,CFile::modeRead))
{
MessageBox("Open file error!");
return;
}
//CString strLine;
char *pbuf;
pbuf = new char[file.GetLength()+10];
memset(pbuf,'/0',file.GetLength()+1);
UINT nBytesRead = file.Read(pbuf, file.GetLength());
m_editFileContent.SetWindowText(pbuf);
file.Close();
delete [] pbuf;
}