Here is my attempt and error:
code:
TCHAR* pszDisplayName_I; //$I .. file
TCHAR *pDollar = NULL;
pszDisplayName_I = ((CString)saSursa.GetAt(i)).GetBuffer();
pDollar = _tcsrchr(pszDisplayName_I,'$');
*(pDollar + 1) = 'I';
error:
error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' C:\Program Files\Microsoft Visual Studio 9.0\VC\atlmfc\include\afxcoll.h
for the getBuffter function I found this:
Returns a pointer to the internal character buffer for the CString object. The returned LPTSTR is not const and thus allows direct modification of CString contents.
So it is ok.
But for the getAt(0) function it says this:
CObject* GetAt(
INT_PTR nIndex
) const;
So there it is, the const thing, is there a way around this? A way in which I might get a modifiable CString element from a CStringArray.
I just compiled this successfully. Instead using GetAt() I used the [] operator.