You need to separate the input and call atof() on each value.
Below is a simple way to do this using strtok. note that it does destroy the input data (add NULL's) so if it's not acceptable you'll need to copy it or find another way (using strchr(), for example).
void use_atof()
{
char c[200];
float val, v;
char *ptr;
strcpy(c ,"23.56,55.697,47.38,87.68");
ptr = strtok(c,",");
while (ptr) {
val = atof(ptr);
printf("%f\n", val);
ptr = strtok(NULL,",");
}
}
EDIT:
Per request, an entire program (tested on Linux):
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void use_atof(void);
int main()
{
use_atof();
exit (0);
}
void use_atof()
{
char c[200];
float val, v;
char *ptr;
strcpy(c ,"23.56,55.697,47.38,87.68");
ptr = strtok(c,",");
while (ptr) {
val = atof(ptr);
printf("%f\n", val);
ptr = strtok(NULL,",");
}
}