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?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.