Hi Michi,
Thank you for the tip about test code!
Unfortunately I miss something in you code example: how would it allow to
detect is data under "/path" bigger than 1024? This is my main problem: the
process that reads data does not know data size. I can read in a cycle
multiplying buffer by 2 till buffer_length will be less than sent but maybe
some better solution exists.

Thank you,
Denis


On Mon, Jun 9, 2014 at 9:28 PM, Michi Mutsuzaki <[email protected]>
wrote:

> Hi Denis,
>
> You can use the unit test code for reference, but something like this
> should work (not tested).
>
> int buffer_length = 1024;
> char buffer[1024];
> zoo_get (handle, "/path", 0, buffer, &buffer_length, NULL);
>
>
> http://svn.apache.org/viewvc/zookeeper/trunk/src/c/tests/TestClient.cc?view=markup
>
>
> On Mon, Jun 9, 2014 at 8:55 PM, Denis Samoilov <[email protected]> wrote:
> > hello,
> >
> > I am sorry for the very n00b question. But I read whole documentation,
> did
> > search for the archives but still do not understand how to get full data
> > from ZK using C binding zoo_get.
> >
> > I expect that
> > *buffer_len* is the size of the buffer
> > <
> http://zookeeper.sourcearchive.com/documentation/3.2.2plus-pdfsg3-2/structbuffer.html
> >
> > pointed to by the buffer
> > <
> http://zookeeper.sourcearchive.com/documentation/3.2.2plus-pdfsg3-2/structbuffer.html
> >
> > parameter. It'll be set to the actual data length upon return. If the
> data
> > is NULL, length is -1.
> >
> > will return me actual data size but it did not. So if I send buffer with
> > size 1 for the data size 3 it returns me 1 in buffer_len :(  (i expect 3
> to
> > allocate new buffer of size 3)
> >
> > It seem I miss something simple but cannot figure out what.
> >
> > Thank you,
> > Denis
>

Reply via email to