[zeromq-dev] help: memcpy with message_t

liuchuanbo at gmail.com liuchuanbo at gmail.com
Tue Aug 6 15:53:16 CEST 2013


I'm using PUB-SUB test with zmq.
pls give me some advices. Thanks.


My code:
---------------------
std::string zipcode = "10001";
zmq::message_t message(zipcode.size()+1);

// it's OK.
memcpy ((void *) message.data(), "10001", zipcode.size()+1);

// it's Error, subscriber always receives bizarre code.
memcpy ((void *) message.data(), &zipcode, zipcode.size()+1);
---------------------



--
Best Regards,
Roy Liu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130806/bb6e2c3a/attachment.htm>


More information about the zeromq-dev mailing list