I could not find anything on the subject, maybe check documentation on your API.
I eventually ran this at GPT (yeah, I know). I have no idea if this will help you and I also make no claim to the code generated...
The error is likely occurring because the redisCommand() function is being called incorrectly. The redisCommand() function takes a format string as its first argument, which should include a format specifier for each additional argument passed to the function. In this case, the format string is "PING %s", which includes a %s format specifier, indicating that an additional string argument will be passed to the function. However, only one argument is passed to the function: the format string itself.
To fix the error, you should pass the additional argument to the redisCommand() function as a separate parameter.
#include <hiredis/hiredis.h>
int main(int argc, char **argv) {
redisReply *reply;
redisContext *c;
c = redisConnect("127.0.0.1", 6379);
if (c == NULL || c->err) {
if (c) {
printf("Connection error: %s\n", c->errstr);
redisFree(c);
} else {
printf("Connection error: can't allocate redis context\n");
}
return 1;
}
reply = redisCommand(c, "PING %s", "HelloWorld");
printf("RESPONSE: %s\n", reply->str);
freeReplyObject(reply);
redisFree(c);
return 0;
}