Hi @metis,
I thought I was the only “old school” strtok() guy here. I also use strtok to parse XML structure reading an RSS feed based on the double-quote characters. My code depends on the order of the parameters, but it could be rewritten easily to use the values instead. The string to parse looks like:
<header param1="value1" param2="value2" .../>
My code looks like:
int fieldn = 1;
char * p = strtok(dataStr, "\"");
while (p != NULL) {
//get the values for
if (fieldn == 2) { // value for 1st param
...
} else if (fieldn == 6) { // value for 3rd param (skip 2nd)
...
} else if (fieldn == 8) { // value for 4th
...
} else if ( fieldn == 10) { // and the 5th
...
}
fieldn++;
p = strtok(NULL, "\"");
}