#include "input.h" #include int readWord(char *buffer, char *divisor, char words[][MAX_WORD_LEN], unsigned int maxWordCount, int *count); int readWords(FILE *file, char words[][MAX_WORD_LEN], unsigned int maxWordCount) { char buffer[MAX_LINE_LEN]; int count = 0; char *divisor = " ,;.\n"; while (fgets(buffer, MAX_LINE_LEN, file) != NULL) { for (char *word = strtok(buffer, divisor); word != NULL && count < maxWordCount; word = strtok(NULL, divisor)) { strncpy(words[count], word, MAX_WORD_LEN); ++count; } } return count; }