Results 1 to 3 of 3

Thread: argh!!!

  1. #1

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471

    argh!!!

    can anyone tell me what i'm doing wrong here....

    i've been looking at this for too long

    Code:
    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();
    it keeps crashing when it tries to delete[] pBuf

    any ideas?
    Bababooey
    Tatatoothy
    Mamamonkey

  2. #2

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    der!!!

    nm, figured it out


    Code:
    char* pBuf;
    pBuf = strItem.GetBuffer( nLen );
    file.Write(pBuf, nLen);
    strItem.ReleaseBuffer( nLen );
    Bababooey
    Tatatoothy
    Mamamonkey

  3. #3

    Thread Starter
    Hyperactive Member noble's Avatar
    Join Date
    Nov 2000
    Location
    Philly
    Posts
    471
    ahhh
    thank you very much
    Bababooey
    Tatatoothy
    Mamamonkey

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width