[c] searching for a word in a file
How do I search a file for a specified keyword? I just dont really know how to traverse through a file with all the spaces and tabs and new lines... Thanks a lot!!!
The function you probably want is strstr() from <string.h>. You could use getline() or fgets() to iterate through the file line-by-line.
If it's not acceptable to find "foobar" when searching for "foo", you'll need some logic to avoid that.
I'm being a little vague because this sounds like homework :D
|All times are GMT -5. The time now is 06:55 PM.|