I'm trying to assign data coming from a webhook response to a Spark.variable and am getting a compilation error I can't resolve.
error: cannot convert 'char**' to 'char*' for argument '1' to 'char* strcpy(char*, const char*)'
char *msg[256];
void setup() {
Spark.subscribe("hook-response/pulltext_/0", hookResonseHandler, MY_DEVICES);
Spark.variable("message", &msg, STRING);
}
void loop() {}
void hookResonseHandler(const char *event, const char *data)
{
strcpy(msg, String(data));
}
The webhook response looks like:
{"name":"hook-response/pulltext_/0","data":""Hello "","ttl":"60","published_at":"2015-08-19T10:39:17.030Z","coreid":"null"}
I don't know enough C to really understand why this won't compile. But when I try a few reasonable variations, the variable does not get set. How can I make this work? Thx!