can anyone tell me what i'm doing wrong here....
i've been looking at this for too long
it keeps crashing when it tries to delete[] pBufCode:CString strItem = ""; int j = 0; char* pFileName = _T("Points.dat"); CFile file( pFileName, CFile::modeCreate | CFile::modeWrite ); // Write data to file // Format: // Point [TAB] Type [TAB] Selector [TAB] Delta [TAB] Commit \r\n // ... int nListCount = m_PointsList.GetItemCount(); for(int i = 0; i < nListCount; i++) { for(j = 0; j < 5; j++) { strItem = m_PointsList.GetItemText( i, j ) + "\t"; UINT nLen = (UINT) strItem.GetLength(); char* pBuf = new char[nLen + 1]; pBuf = strItem.GetBuffer( nLen + 1 ); file.Write(pBuf, sizeof(pBuf)); delete[] pBuf; strItem.ReleaseBuffer( nLen + 1 ); } } file.Close();
any ideas?




Reply With Quote