zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From 吴腾飞 <wuteng...@yy.com>
Subject The problem of using c binding function
Date Sat, 12 Oct 2013 02:08:39 GMT
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.


Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message