diff --git a/Start_Windows/input.c b/Start_Windows/input.c index ed77805..5713d9f 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -8,5 +8,21 @@ // 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; -} \ No newline at end of file + 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, " ,;"); + } + } + //printf("\n %d", counter); + + return counter; +}