16,473
社区成员
发帖
与我相关
我的任务
分享
void RichEditView::ReadArticle(CString strName)
{
CMainFrame* pFrame = (CMainFrame*)AfxGetMainWnd();
CString content = "";
CStdioFile File;
CString fileName = strName;
if (File.Open(fileName, CFile::modeRead | CFile::typeBinary))
{
File.SeekToBegin();
CString str = "";
File.ReadString(str); // 读取第一行,不保存
while (File.ReadString(str)) //从第二行开始逐行读取
{
content += str;
AfxMessageBox(str);
}
File.Close();
}
else
AfxMessageBox("读取失败!");
::SetWindowText(this->GetRichEditCtrl().m_hWnd, content);
}
File.ReadString(str); // 读取第一行,不保存