How do you tokenize when you read from a file in C?
textfile:
PES 2009;Konami;DVD 3;500.25; 6
Assasins Creed;Ubisoft;DVD;598.25; 3
Inferno;EA;DVD 2;650.25; 7
char *tokenPtr;
fileT = fopen("DATA2.txt", "r"); /* this will not work */
tokenPtr = strtok(fileT, ";");
while(tokenPtr != NULL ) {
printf("%s\n", tokenPtr);
tokenPtr = strtok(NULL, ";");
}
Would like it to print out:
PES 2009
Konami
.
.
.