简体   繁体   English

解析从 C# 到 C++ 正文的 MSMQ 消息,每个字母由 '0 分隔

[英]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++.我正在从 C# (ActiveXFormatter) 向 MSMQ 发送一条消息,并尝试在 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++).我阅读的正文确实是我发送的消息的正文,但每两个字符之间有一个“0”(在 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 VT_VECTOR | VT_UI1 . VT_VECTOR | VT_UI1

I've try opening the MSMQ with VT_BSTR with no luck我尝试使用VT_BSTR打开 MSMQ,但没有成功

In C# I'm sending the message with a simple ActiveXFormatter _sendQueue.Formatter = new ActiveXMessageFormatter(); _sendQueue.Send(myString);在 C# 中,我使用简单的 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.通过更改 C# 中的编码并发送一个空终止字节数组来修复它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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