|
我想实现的是随时地向txt中写入,可是每次都是把原先得给覆盖了,代码如下:
CString strNL;
CFile m_fSaveFile;
TCHAR* pFileName = _T("\USB Storage\\Text.txt");
m_fSaveFile.Open(pFileName,CFile::modeCreate | CFile::modeReadWrite | CFile::typeText);
strNL.Format(_T("\r\n"));
CString str1=m_list1.GetItemText(nItem,0)+L" "+m_list1.GetItemText(nItem,1)+L" "+m_list1.GetItemText(nItem,2)+L" "+m_list1.GetItemText(nItem,3)+strNL;
m_fSaveFile.Seek(0,CFile::current);
m_fSaveFile.Write((void*)(LPCTSTR)str1,str1.GetLength()*2);
m_fSaveFile.Close();
不知为什么?怎么来控制我要加入的位置?急!在线等! |
|