finish wordsalad

- remove printf for debugging and add startGame to main.c
This commit is contained in:
hoangto105860 committed 2026-10-27 16:59:33 +01:00
1 parent cbf5f85caf
commit 596e0a5519
7 files changed
+8 -35

No files matched your search

+1 -10
View File
@@ -11,22 +11,18 @@
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
{
printf("start readWords\n");
int wordcount = 0;
char buffer[256];
char *line = fgets(buffer, sizeof(buffer), file);
while(line != NULL)
{
printf("%d. loop\n", wordcount);
printf("line: %s\n", line);
char* word = strtok(line, " ,;");
while (word != NULL)
{
strncpy(words[wordcount], word, strlen(word));
//printf("%d. word: %s\n", wordcount, words[wordcount]);
wordcount += 1;
word = strtok(NULL, " ,;\t\n");
@@ -46,12 +42,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
words[i][j] = '\0';
}
}
printf("%d. word: %s\n", i, words[i]);
}
printf("wordcount = %d\n", wordcount);
return wordcount;
}