diff --git a/Start_Windows/input.c b/Start_Windows/input.c index 64ad407..f887d73 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -2,11 +2,13 @@ #include #include -static char *singleWordBuffer; +static char *buffer; // TODO: // eine Funktion implementieren, die ein einzelnes Wort aus einer Textdatei (words.txt) einliest und als C-String zurückgibt. + +/* char *readSingleWord(FILE *file) { if (file == NULL) @@ -18,9 +20,29 @@ char *readSingleWord(FILE *file) fgets(singleWordBuffer, MAX_LINE_LEN, file); } - +*/ + // Read words from file and store in 'words' array +int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) +{ + int i = 0; + int numberOfReadWords = 0; + char currentChar = 0; + + + do + { + fgetc(file + i); + + i++; + } while (currentChar != EOF); + + + + return numberOfReadWords; +} + /*