CStudioFile 是CFile 的派生类,可逐行读写
CStudioFile f2; CString str; CString mstr; CString path; int n=0; path=_T("Storage Card\\shuipwy1.dat"); if( f2.Open(path,CFile::modeNoTruncate|CFile::modeRead) == false) { AfxMessageBox(_T("文件不存在")); } else { //f2.SeekToEnd(); 从末尾开始添加 //f2.WriteString(_T("bbbbb")); //f2.Abort(); while(f2.ReadString(str)) { if(n>0) { mstr+=str+_T("\r\n"); } n++; } } AfxMessageBox(mstr); }