int main(int argc, char*argv[])
{
char word[MAXWORD]; // current word
List matches; // list of matched words
char *substring; // string to look for
FILE *input; // the input file
/* ... Check command-line args, open input file ... */
/* Process the file - find the matching words */
matches = NULL;
while (getWord(input, word) != NULL) {
if (contains(word,substring)
&& !member(matches,word))
matches = insert(matches,word);
}
printWords(matches);
return 0;
}
|