I want to insert data to redis in C. I found hiredis library.
I wrote an example:
redisContext *c = redisConnect("127.0.0.1", 6379);
if (c != NULL && c->err)
{
printf("Error: %s\n", c->errstr);
// handle error
} else
{
printf("Connected to Redis\n");
}
redisReply *reply;
reply = (redisReply *)redisCommand(c, "AUTH 123456");
if(reply->type==5)
{
reply = (redisReply *)redisCommand(c,"SET %d %d",32,111);
freeReplyObject(reply);
reply = (redisReply *)redisCommand(c,"GET %d",32);
printf("%s\n",reply->str);
int ii = redisAppendCommand(c,"SADD %d %d",32,33);// MY PROBLEM IS HERE
printf("-------SADD---------------- %d\n",ii);
I don't know how to use SADD command. Please, help me.