I tried what you said but I don't know how the txt file should look like or how to get the code to use the txt file.
Originally Posted by Adak
To commonTater, I fixed that error where it had a limit on the amount of words the sentence could be. I have a char array with 'a unknown size' now.
Here is the code I have:
Adak, can I ask you to fix the code so it can read from the txt file and show me how the txt file should look?
int main ()
char *b = malloc(sizeof(char));
char * pch;
FILE * fp;
fp = fopen("worklist.txt", "r");
printf("Input a short sentence: ");
pch = strtok (b," ,.-");
while (pch != NULL)
pch = strtok (NULL, " ,.-");