What he meant was that C or C++ will look for a special "guard" byte at the end 
of every string.

It must be '\0' and not some other character.  That is how strings are 
represented in these languages.

--
Wolf

On Aug 30, 2010, at 2:30 PM, Naveen Chawla <[email protected]> wrote:

> In C++ to C++, I was sending a message inited to 6 bytes containing "Hello".
> In Java, the problem described persists even if, as per your
> suggestion, I send an extra character, e.g. "Hellox".
> 
> On 30 August 2010 19:02, Pieter Hintjens <[email protected]> wrote:
>> On Mon, Aug 30, 2010 at 7:29 PM, Naveen Chawla <[email protected]> wrote:
>> 
>>> C++ to C++ works fine. Message is only "[Hello]"
>> 
>> You're sending five bytes, 'Hello', which is not a valid C string as
>> required by the printf function.  Either send six bytes (string plus 0
>> byte) or else convert the received message data to a valid string.
>> 
>> I've wondered if 0MQ should not automatically and always append a null
>> byte to received messages (not included in stated message size) so
>> that strings can be safely passed between C/C++ and other languages.
>> 
>> -
>> Pieter Hintjens
>> iMatix - www.imatix.com
>> _______________________________________________
>> zeromq-dev mailing list
>> [email protected]
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>> 
> _______________________________________________
> zeromq-dev mailing list
> [email protected]
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
_______________________________________________
zeromq-dev mailing list
[email protected]
http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Reply via email to