I have problems converting CString to const char *. I tried the methods from other forums and msdn way and it doesn't work:
CString value1("text1");
const char * value2= LPCTSTR(value1);
Any idea ?
I have problems converting CString to const char *. I tried the methods from other forums and msdn way and it doesn't work:
CString value1("text1");
const char * value2= LPCTSTR(value1);
Any idea ?
Get pointer of the internal character buffer of CString
const char * value2 = (const char *) value1.GetBuffer( value1.GetLength() );
Release the buffer when done.
value1.ReleaseBuffer()
The ReleaseBuffer() gives ownership of the buffer back to CString.