fertig
This commit is contained in:
1 parent
eb37f451d0
commit
6259f06391
9 files changed
+109
-1
No files matched your search
@@ -8,5 +8,18 @@
|
||||
// Read words from file and store in 'words' array
|
||||
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
||||
{
|
||||
unsigned int wordCount = 0;
|
||||
char buffer[MAX_WORD_LEN];
|
||||
|
||||
while (wordCount < maxWordCount && fscanf(file, "%s", buffer) == 1) {
|
||||
|
||||
for (int i = 0; buffer[i]; i++) {
|
||||
buffer[i] = tolower(buffer[i]);
|
||||
}
|
||||
strncpy(words[wordCount], buffer, MAX_WORD_LEN - 1);
|
||||
words[wordCount][MAX_WORD_LEN - 1] = '\0';
|
||||
wordCount++;
|
||||
}
|
||||
|
||||
return wordCount;
|
||||
}
|
||||
Reference in new issue
Block a user