#include #include "wordlist.h" Wordlist::Wordlist(char *filename) { infile = fopen(filename, "r"); if (infile == NULL) { cout << "Input file not found\n"; return; } } int Wordlist::readWord(char *buffer, int buflength) { char *p, *k; p = fgets(buffer, buflength, infile); if (p == NULL) return 0; // trim away last character (assumed to be NL) k = buffer; while (*k != '\0') k++; if (k != buffer) *(--k) = '\0'; return 1; } Wordlist::~Wordlist() { fclose(infile); }