简体   繁体   中英

MSMQ Message from C# to C++ body is parsed with each letter being separated by '0

I'm sending a message to an MSMQ from C# (ActiveXFormatter) and trying to read it in C++. The body that I read is indeed the body of the message I sent but there is a '0' between each two characters (in C++). I think it has to do with encoding but I'm not sure how to fix it. I'm opening the MSMQ with VT_VECTOR | VT_UI1 VT_VECTOR | VT_UI1 .

I've try opening the MSMQ with VT_BSTR with no luck

In C# I'm sending the message with a simple ActiveXFormatter _sendQueue.Formatter = new ActiveXMessageFormatter(); _sendQueue.Send(myString);_sendQueue.Formatter = new ActiveXMessageFormatter(); _sendQueue.Send(myString);

Fixed it by changing the Encoding in C# and sending a null-terminated byte array.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM