I have the following text file:
Anna 199.9 2000.2
John 300.9 400.2
Linda 200.9 7.00
Harry 90.9 20.9
Code:
char * split;
printf ("Splitting string \"%s\" in tokens:\n",buffer);
split = strtok (buffer," ");
while (split != NULL)
{
printf ("%s ",pch);
split = strtok (NULL, " ,");
}
I've used strok, and have sucessfully splitted the 3 rows into seperate tokens. The problem i'm having is storing these values temporarly somewhere so i can add them to a link list. I can't assign the splitted value to a new char but then when the loop creates another token this will be overwritten.