I have managed to modify it as I needed.
The new function reads as below...
void scantext(char* tag, char* value)
{
char* label;
char* firstquote;
char* secondquote;
char lengthofvalue;
label=strstr(incoming,tag);
if (label)
{
firstquote=strstr(label+1,"\"");
secondquote=strstr(firstquote+1,"\"");
lengthofvalue=secondquote-firstquote-1;
strncpy(value,firstquote+1,lengthofvalue);
value[lengthofvalue]='\0';
}
else
{
strcpy(value,"NOT FOUND");
}
}
The calling code for it defines the tag and value char arrays, sets tag to what I am looking for and receives the value, code snippet as below
char tag[10];
char value[25];
strcpy(tag,"STAIP");
Serial.print("Tag "); Serial.print(tag);
scantext(tag,value);
Serial.print(" Value = "); Serial.println(value);
setting tag to STAIP returns this
Tag STAIP Value = 192.168.1.117
setting tag to STAMAC returns
Tag STAMAC Value = 5c:cf:7f:65:fa:00
and setting it to TEST (which is not present) returns
Tag TEST Value = NOT FOUND
Thank you both for your assistance. I can get on with writing the rest of the code now. It's a PV energy monitor which monitors PV output, mains import/export and heater diverted power with current transformers and the Open Energy Monitor library then uploads that data every minute to thingspeak via wifi. It also displays the values on a 4 line LCD display.