cVector3d newPosition = tool->getDeviceGlobalPos();
char sendBuf[sizeof(double)*3 + 1];
int sendBufLen = sizeof(double)*3 + 1;
memset( (void *)&sendBuf, '\0', sizeof(sendBuf));
memcpy(&sendBuf, &newPosition[0], sendBufLen -1);
where cpi is a pointer to a com interface's object. Multicast is a c# method which accepts string arguments. When I print the message.length that Multicast has received, which is sendBuf it just says 2 instead of 24.
reference for cvector3d http://www.chai3d.org/doc/structc_vector3d.html
what is wrong with cpi->Multicast(sendBuf); ?
--edit-- I need to convert sendBuf to _bstr_t I think
I converted to _bstr_t but the message.length still shows 2 instead of 24?
I used
_bstr_t bstrt(sendBuf);
I guess bstr is corrupt as when I debug I see a BAD PTR in bstr->m_data->m_str
----edit---- Whnen I convert "123456789012378901234"
char sendBuf[sizeof(double)*3 + 1];
memcpy(&sendBuf, "123456789012345678901234", sendBufLen -1);
_bstr_t bstrt(sendBuf);
bstrt has "123456789012378901234"
but when I have weird characters in sendBuf as in for eg. sendBuf[14] = "16 'ð' " which my program needs bstr doesnt get these values from sendBuf
why?