with open("fb_bytes.bin", "rb") as f: buf = f.read() foo = Client.Person.Person.GetRootAs(buf) print(foo.Name().decode('utf-8'), end = ", ") print(str(foo.Age()), end = ", ") print(str(foo.Weight())) buf = buf[48:] foo0 = Client.Person.Person.GetRootAs(buf1) print(foo0.Name().decode('utf-8'), end = ", ") print(str(foo0.Age()), end = ", ") print(str(foo0.Weight()))
len()by writing only one
Personand thus sliced the
auto pName = builder.CreateString("BiasdasdgFoot"); auto pAge = 91; auto pWeight = 123.5; auto Person = CreatePerson(builder, pName, pAge, pWeight, Gender_Male); // builder.FinishSizePrefixed(Person); builder.Finish(Person);
Personwithout using vector?
Personand keep appending to the file?
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=DEBUG
builder.Clear()and reusing it.
flatcfor this use case, maybe by writing a plugin for it?
flatcis able to write out a binary version of a parsed schema.. using FlatBuffers itself! This data is perfect for writing external code generators. You can easily read this data in any language that FlatBuffers already supports. The option is
--bfbsI believe, and the schema for the data is in
reflection/.. see also some github issues where we talk more about using this for external code generators @dbaileychess