10 size_t message_length;
22 SimpleMessage message = SimpleMessage_init_zero;
28 message.lucky_number = 13;
29 message.unlucky.number = 42;
32 status =
pb_encode(&stream, SimpleMessage_fields, &message);
33 message_length = stream.bytes_written;
51 SimpleMessage message = SimpleMessage_init_zero;
57 status =
pb_decode(&stream, SimpleMessage_fields, &message);
67 printf(
"Your lucky number was %d!\n", message.lucky_number);
68 printf(
"Your unlucky number was %u!\n", message.unlucky.number);