Char String to Float Array

Hi - I have a series of comma-separated values being read from a text file (SPIFFS) and populating arrays. Here's an example of a functional code that works for Int arrays (blockWPS in this one):

/* int blockWPS[20] */

if (i == 12) { /* reading from line 12 of the txt file */
      s.toCharArray(c, 200);
      int result = sscanf(c, "%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i,%i", &blockWPS[0], &blockWPS[1] , &blockWPS[2], &blockWPS[3], &blockWPS[4], &blockWPS[5], &blockWPS[6] , &blockWPS[7], &blockWPS[8], &blockWPS[9], &blockWPS[10], &blockWPS[11] , &blockWPS[12], &blockWPS[13], &blockWPS[14], &blockWPS[15], &blockWPS[16] , &blockWPS[17], &blockWPS[18], &blockWPS[19]);
    };

Here's an example that does not work for Float arrays (scatterArea):

    /* float scatterArea[20] */
if (i == 13) {
      s.toCharArray(c, 200);
      float result = sscanf(c, "%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f,%f", &scatterArea[0], &scatterArea[1] , &scatterArea[2], &scatterArea[3], &scatterArea[4], &scatterArea[5], &scatterArea[6] , &scatterArea[7], &scatterArea[8], &scatterArea[9], &scatterArea[10], &scatterArea[11] , &scatterArea[12], &scatterArea[13], &scatterArea[14], &scatterArea[15], &scatterArea[16] , &scatterArea[17], &scatterArea[18], &scatterArea[19]);
    };

I've used s.toFloat(); successfully for single value reads, but I'm not sure how to make it work with 20 comma separated values. I've done a bit of reading about the atof() command, still trying to think of how to apply it with these arrays though.

Any help would be great, thanks!

Have a look at strtok() to find each comma and then atof()

J-M-L:
Have a look at strtok() to find each comma and then atof()

I'm trying and failing, I'll have to go at it again in the morning when my brain function returns 8)

Example #5 of the serial input basics thread uses strtok() and atof() so may be of help to understand using those functions.