13 return fwrite(buf, 1, count, file) == count;
19 Person person = {
"Test Person 99", 99,
true,
"test@person.com",
20 3, {{
"555-12345678",
true, Person_PhoneType_MOBILE},
21 {
"99-2342",
false, 0},
22 {
"1234-5678",
true, Person_PhoneType_WORK},
31 if (
pb_encode(&stream, Person_fields, &person))
bool streamcallback(pb_ostream_t *stream, const uint8_t *buf, size_t count)
size_t fwrite(const void *__restrict ptr, size_t size, size_t nmemb, FILE *__restrict stream)
#define PB_GET_ERROR(stream)
bool pb_encode(pb_ostream_t *stream, const pb_msgdesc_t *fields, const void *src_struct)
#define SET_BINARY_MODE(file)