What does the error mean? I just need to return the value I get from the redis command.
int getReply(char* result)
{
redisContext *c;
redisReply *reply;
c = redisConnect((char*)"127.0.0.2", 6379);
reply = redisCommand(c,"GET %s", "somekey");
if (reply->str != NULL)
{
result = strdup(reply->str);
strerror(errno); // <-------- 'Operation now in progress'. result = null
}
freeReplyObject(reply);
reply = redisCommand(c, "QUIT");
printf("Disconnecting redis: %s\n", reply->str);
freeReplyObject(reply);
return 0;
}
This happens even if I slowly step through it with the debugger (one would assume that any blocking action has long finished then). Redis specific error strings are empty, reply->str has the correct string that I want.
Okay for everyone following up on this: This is my bad, I need to pass in the address of a pointer, otherwise it will just pass in the value. So do it like this:
int getReply(char** result)
{
*result = "yes";
}