#include "input.h" #include #include // TODO: // eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. // Read words from file and store in 'words' array int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { int counter = 0; //word's numbers char line[MAX_WORD_LEN]; char *word; while (fgets(line, MAX_LINE_LEN, file) != NULL && counter < maxWordCount) { //printf("%s", line); word = strtok(line, " ,;"); while (word != NULL && counter < maxWordCount) { strcpy(words[counter++], word); //printf ("%s\n",word); word = strtok (NULL, " ,;"); } } return counter; }