文件读写问题,请教老师!
一个文本文件我读入到CSTRING对象处理完毕,我想删除原来的内容,再存入我的新文本(CSTRING对象),其中文件对象m_file为全局地。
打开文件:
m_file.Open(dlg.GetPathName(),CFile::modeReadWrite | CFile::shareExclusive))
char *pScrip;
pScrip=new char[m_file.GetLength()];
m_file.Seek(0L,CFile::begin);
m_file.Read(pScrip,m_file.GetLength());
m_strView=pScrip
处理m_strView: ...............................................
保存: m_file.SetLength(0);//我不知道别的方法
m_file.Seek(0L,CFile::begin);
m_file.Write(m_strView,m_strView.GetLength());
m_file.Close();
为什麽文件没变化呢?