Home/Support/Support Forum/Contents of the envelope->payload var in the basic_frame_reception sample

Contents of the envelope->payload var in the basic_frame_reception sample

0 votes
Hello team,

I'm using the sampe called basic_frame_reception to learn programmation with XBees.
When a message is received by the device, it is printed on the serial port.

The message (the payload) is printed by a dump of envelope->payload:
dump(envelope->payload, envelope->length);

(envelope->length = 6)

For example, if the message is "CANADA", "CANADA" will be printed on my serial port.

But if I copy envelope->payload into an other var and I print it, the output will be "CANADAA".
strcpy(test,envelope->payload); printf("Var test '%s'\n",test);

I tried with several messages and there is always an added character at the end of my message.

How can you explain this behaviour ?

The aim is to use the message (the correct one) after.

Thanks in advance
asked May 14, 2015 in XBee Programmable Development by Todd New to the Community (9 points)

Please log in or register to answer this question.

1 Answer

0 votes
Todd, where are you finding this sample code "basic_frame_reception"? It would help to know so we have a better idea as to where this question is coming from.
answered Sep 4, 2015 by mvut Veteran of the Digi Community (15,223 points)