Hey,
I call this function as a call back after the user has inputted some
numbers seperated by commas into the char maninput[500] variable (eg,
"30,31,32,33"). I then intend the below function to seperate the
string into the seperate numbers (i.e. 30,31,32,33) and store them in
the float data[500] in the positions [0], [1], [2], [3] respectivly as
the variable i increases. I've never done much with strings like this
before and i can't figure out why the code below doesn't put the data
into 'data[i]'??
Please help :-)
int mancalculate()
{
int i=0, j=0;
char *p;
p = strtok(maninput, ",");
while(p != NULL)
{
data[i] = maninput[*p];
i++;
ndata++;
p = strtok(NULL, ",");
}
return 0;
}
Thanks in advance
Adam Thickett