|
-
December 5th, 2002, 10:10 PM
#1
CString access violations!
Hi,
I'm having access violation problems with CString. Checking the boards, I discovered that I do not suffer alone. A solution recommended was to type cast to LPCTSTR before assigning the new CString value.
I'm still getting access violation problems, though in a new spot. It now appears in the red-line in the following code.
void CString::AssignCopy(int nSrcLen, LPCTSTR lpszSrcData)
{
AllocBeforeWrite(nSrcLen);
memcpy(m_pchData, lpszSrcData, nSrcLen*sizeof(TCHAR));
GetData()->nDataLength = nSrcLen;
m_pchData[nSrcLen] = '\0';
}
The strange thing is, that both before and after the memcpy, the m_pchData points to garbage. I did initialize it.
Hope this info isn't too vague. Hope someone else has suffered through similar problems and has an idea.
Mat.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|