I am trying to split a string into tokens.
("file1.txt") contains this row: 12/04/2007,2111,35.23,35.23,35.20,35.22,15600,35.22
What I am trying to do now is to split this row up into tokens where the "," is the separator. The output that comes from this row will I put in ("file2.txt")
My code that I have tried to build look like this. I suppose I am on the right track but I cant find the ´wrong´ in the code.
char * Tecken;
ifstream myfile ("file1.txt");
myfile >> Rad;
printf ("Splitting string \"%s\" into tokens:\n",Rad);
Tecken = strtok (Tecken,",");
while (Tecken != NULL)
Tecken = strtok (NULL, ",");
Test << Tecken <<"\n";