Nidhin Tomy
Nidhin Tomy

Reputation: 23

Protocol Buffer - c

`stuct` apple
{

    int a;
    char c;

};
struct b
{
int count;
`stuct` apple a[10];
};

How can implement these structures to a message field in protobuff C. I am looking for a alternative method to write struct apple a[10] other than writing 10 times on protobuff. Can you help me? Thanks!

Upvotes: 0

Views: 68

Answers (1)

Nidhin Tomy
Nidhin Tomy

Reputation: 23

Finally i get it.

message b
{
  message apple
  {
    int32 a;
    string c;
  }
  int32 count;
  repeated apple a;
}

This is the prototype message. Use vector implementation of dynamic arrays to use it.It will help to crate N no.of objects of a structure.

Upvotes: 1

Related Questions