22 lines
576 B
C
22 lines
576 B
C
#include "input.h"
|
|
#include <string.h>
|
|
#include <ctype.h>
|
|
#include <stdio.h>
|
|
|
|
// TODO:
|
|
// eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt.
|
|
|
|
int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount)
|
|
{
|
|
unsigned int count = 0;
|
|
|
|
while (count < maxWordCount && fscanf(file, "%s", words[count]) == 1) {
|
|
for (int i = 0; words[count][i]; i++) {
|
|
words[count][i] = toupper((unsigned char)words[count][i]);
|
|
}
|
|
count++;
|
|
}
|
|
|
|
return count;
|
|
}
|