diff --git a/Start_Windows/input.c b/Start_Windows/input.c index e012629..fc57130 100644 --- a/Start_Windows/input.c +++ b/Start_Windows/input.c @@ -10,9 +10,9 @@ static char *buffer; // 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 word = 0; - int wordChar = 0; + int i = 0; + int word = 0; + int wordChar = 0; int firstLetter = 0; if (file == NULL) @@ -20,9 +20,9 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) return 0; } - fgets(buffer, MAX_LINE_LEN, file); + fgets(buffer, MAX_LINE_LEN * maxWordCount, file); //fscanf(file, "%s", buffer); - + do { @@ -55,7 +55,7 @@ int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) } i++; - } while ((i < MAX_LINE_LEN) || (word < maxWordCount)); - - return word+1; + } while ((i < MAX_LINE_LEN) && (word < maxWordCount)); + + return word + 1; } diff --git a/Start_Windows/input.o b/Start_Windows/input.o index 1991050..8baf5ca 100644 Binary files a/Start_Windows/input.o and b/Start_Windows/input.o differ diff --git a/Start_Windows/runTests.exe b/Start_Windows/runTests.exe index a38ee2f..260666a 100644 Binary files a/Start_Windows/runTests.exe and b/Start_Windows/runTests.exe differ