Hi

 

I using c client binding fuction zoo_aget,the passed data cause problem.

 

ZOOAPI int zoo_aget(zhandle_t *zh,const char *path,int
watch,data_completion_t completion,const void *data)

 

1.Using like this is ok:

 

int ret = zoo_aget(zkhandle, path,0,DataCompletion,” zoo_aget”);

DataCompletion:

DataCompletion(int rc, const char *value, int value_len, const struct Stat
*stat, const void *data)

{

  Cout<<data<<endl;//out put is :zoo_aget

}

 

2.But this is no right:

Char* data = “zoo_aget”;

int ret = zoo_aget(zkhandle, path,0,DataCompletion, data);

DataCompletion:

DataCompletion(int rc, const char *value, int value_len, const struct Stat
*stat, const void *data)

{

  Cout<<data<<endl;//out put is not zoo_aget

}

 

Why I in 2 can not got correct output?Using zoo_axxx,pass data also the same
question.

 

Thanks,

 

Albert Wu.

Reply via email to