If CString to LPCTSTR (const), cast it directly. Am I correct?
If CString to LPTSTR, call GetBuffer() and ReleaseBuffer() between the block that use the LPTSTR variable. Am I correct?
If CString to LPCTSTR (const), cast it directly. Am I correct?
If CString to LPTSTR, call GetBuffer() and ReleaseBuffer() between the block that use the LPTSTR variable. Am I correct?
Yes, you can get an unmodifiable view of the underlying character array by casting, which calls CString's conversion operator.
And you can get a writable buffer by calling GetBuffer(), and you should call ReleaseBuffer() when you're done writing it, and want to use the CString again.