Personally I'm with jasit... it's easier to simply search for the colon because then you can easily find the column name and the contents of the column all by searching for one character.
An example (to just fetch the data not the column information) would look something like:
char * parseCommand(const char * toParse, const char toFind, char *results) {
char * spot = strchr(toParse, toFind);
results[0] = '\0';
if (spot != NULL) {
// Warning: Make sure that 'results' is large enough to hold the string
return strcpy(results, &toParse[spot - toParse + 2]);
}
else
return NULL;
}
[...]
parseCommand("AVRCP_MEDIA TITLE: Captain", ':', name);
parseCommand("AVRCP_MEDIA ARTIST: Dave Matthews Band", ':', artist);
parseCommand("AVRCP_MEDIA ALBUM: Busted Stuff", ':', album);
parseCommand("AVRCP_MEDIA NUMBER: 337", ':', mediaNo);
parseCommand("AVRCP_MEDIA TOTAL_NUMBER: 498", ':', totalNo);
parseCommand("AVRCP_MEDIA GENRE: Rock", ':', genre);
Not really a very good example of usage but I hope you get the idea.
Regards,
Brad
KF7FER