Write a C program that allows the users to search for any word in a text
file. The program must return the line number in which the words where
found as well as the line the word occurred on ( assume that a line is not
more than 300 words).
Allow the user to use wildcards.
Allow the following types of input to the program.
Rabbit: The program searches for all words with the correct
P*: The program searches for all words beginning with p.
*t : The program searches for all words beginning with t.
*g* : The program searches for all words beginning with the letter
*ro*: The program searches for all words with the letters r and o.
i would appreciate any help with this question....or useful sites ...thank
There is aprogram that does something like that on UNIX and it is called
'grep'. There is a free open source version of this program, in the GNU
project. Search the source for this program and learn from it.
I know that grep is a much more complex program than that you need and
thus it is not ideal to learn from but I do not no better example.
[ back to toc ]