CFile myFile(_T( " tt1.txt " ), CFile::modeCreate | CFile::modeReadWrite); CArchive ar( & myFile, CArchive::store); ar.WriteString( " nihao " ); // msdn上本函数每次写入一行,测试失败 ar.WriteString(_T( " \n " )); ar.WriteString( " 3 " ); ar.WriteString(_T( " \n " )); ar.WriteString( " 4s dsf " ); ar.WriteString(_T( " \n " )); ar.WriteString( " hello worlds " ); ar.WriteString(_T( " \n " )); ar.Close(); myFile.SeekToBegin(); CArchive arLoad( & myFile, CArchive::load); CString stmp; CString ss; arLoad.ReadString(ss); // 可以读入一行,没错 stmp += ss + " \n " ; arLoad.ReadString(ss); stmp += ss + " \n " ; arLoad.ReadString(ss); stmp += ss + " \n " ; arLoad.ReadString(ss); stmp += ss + " \n " ; arLoad.ReadString(ss); stmp += ss + " \n " ; MessageBox(stmp); arLoad.Close(); myFile.Close();