[zeromq-dev] zmsg.hpp

Ilja Golshtein ilejncs at narod.ru
Wed May 4 13:28:53 CEST 2011


Actually I still don't understand if it is guaranteed 0 is present, or code like
==
char s[VERY_LONG];
sock.recv(&msg);
strcpy(s, msg.data());
s[msg.length()] = 0;
==
relies on the destiny.

Asking just out of curiosity.

04.05.2011, 15:00, "Martin Lucina" <mato at kotelna.sk>:
> ph at imatix.com said:
>>  I've covered this in the Guide quite early on since it's a major
>>  problem. It is unsafe to assume in C/C++ a message is ASCIIZ because
>>  that breaks interop with other languages.
>>
>>  0MQ strings are length-specified. One of the classes that czmq
>>  provides is zstr which reads/writes C strings to/from 0MQ strings.
>>  Similar functionality is in the zmsg.hpp header too.
>
> "0MQ strings"? /me does not know that such a thing exists...
>
> Incidentally, a couple of times I got people saying "0MQ messages are
> ASCIIZ strings", which is complete bogus. They seem to get this idea from
> the guide ... :-/
>
> -mato
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

-- 
Best regards,
Ilja Golshtein.



More information about the zeromq-dev mailing list