I've run into a slight issue that I can't figure out in regards to storing integers in redis. I'm inserting some uint16_t's using the hiredis C client. Things are going in fine, and when I check the values from the command line, the values in redis appear correct.
However, I'm doing something wrong retrieving the records and was looking for a little help.
My insert command is:
redisAppendCommand ( self->rctx, "SADD %lu %d",
self->interval, self->data );
self->data is defined within a struct as:
uint16_t data;
Looking within my set with SMEMBERS, the data looks good.
Retrieving the data with:
redisReply *reply = redisCommand ( self->rctx,
"SMEMBERS %lu", self->interval );
And then iterating over the replies:
for (i=0, i<reply->elements, i++) {
}
How do I properly retrieve reply->element[i] (which should be the uint16_t I stored) properly so that I retrieve the correct value?
Thanks for any help,
Brian