I'm trying to build a char array for storing the return value of a function. In the following function the data is stored in ***valv. How to build a extern variable to access the data?
int credis_lrange(REDIS rhnd, const char *key,
int start, int end, char ***valv)
{
int rc;
if ((rc = cr_sendfandreceive(rhnd, CR_MULTIBULK, "LRANGE %s %d %d\r\n",
key, start, end)) == 0)
{
*valv = rhnd->reply.multibulk.bulks;
rc = rhnd->reply.multibulk.len;
}
return rc;
}
Solution:
char **elements;
int size = credis_lrange(this->redis,"object_2",600,603,&elements);
for (int i=0; i<size;i++) {
cout << "element: " << elements[i] << endl;
}
Thanks to everyone!