I am using Visual C++ 2008. In my code, I get a variable of BSTR. Now I want to change the first half of the characters in it. How to do so?
For example, if the string contains 5000 characters, then I want to modify the first 2500 characters in its buffer directly. Is there a easy way to do so?
I understand that I can convert BSTR to CString, or std::string, then do the replacement. But that will consume extra memory and time, especially when the string is very long. So I hope to modify the buffer of BSTR directly. That will be fast and efficient.
you dont need to convert anything and waste memory, use Attach/Detach