I have the following pointer:
BSTR *PREVIOUS;
And I want make a new copy to:
BSTR *NEW;
I want to copy the CONTENTS/DATA (that PREVIOUS is pointing) from PREVIOUS to NEW.
I’ve just tried the following command, but it doesn’t work:
memcpy(NEW,PREVIOUS,SysStringByteLen(*PREVIOUS));
I dont see any error when compiling because I am working on ATL COM environment. Please help. Thank you!
BSTRis itself already a pointer, you should almost always use just a plainBSTR, not aBSTR*(which is a pointer to aBSTR). Ordinarily, you would copy aBSTRwithSysAllocString:If you really do have a pointer to a
BSTR(such as via a function’s out parameter), then you add a layer of indirection: