How to convert CString to char* or LPTSTR?
Well, you can use CString::GetBuffer() to access the internal buffer of CString. But one thing to take care is that – you should release the buffer by calling CString::ReleaseBuffer() after use. Check the code snippet below,
// Our CString object.
CString String = "HelloWorld";
// Get the internal buffer pointer of CString.
LPTSTR pString = String.GetBuffer( 0 );
...
// Use the pString and then release it.
String.ReleaseBuffer();

0 comments:
Post a Comment