consider following just posted in another thread
add a parallel array of ints using atoi() of the tokens
char s [80];
#define MaxTok 10
char *toks [MaxTok];
// -----------------------------------------------------------------------------
int
tokenize (
char *s,
const char *sep )
{
unsigned n;
toks [0] = strtok (s, sep);
for (n = 1; (toks [n] = strtok (NULL, sep)); n++)
;
return n;
}
// -----------------------------------------------------------------------------
void dispToks (
char * toks [])
{
for (unsigned n = 0; toks [n]; n++)
Serial.println (toks [n]);
}
// -----------------------------------------------------------------------------
void loop ()
{
if (Serial.available ()) {
int n = Serial. readBytesUntil ('\n', s, sizeof(s));
s [n] = 0; // terminate string
tokenize (s, ",");
dispToks (toks);
}
}
// -----------------------------------------------------------------------------
void setup ()
{
Serial.begin (9600);
}