How can I check if a given FILE* contains a string in C running on Linux (if it matters)?
The string must consist of the whole line it's on. For example, this:
jfjfkjj
string
jfjkfjk
would be true; but this:
jffjknf
fklm...string...lflj
jfjkfnj
wouldn't. I'm essentially looking for an internal alternative to system("grep -x file")
This reads a file line by line and checks if the line matches the string supplied in argument 1 (
argv[1]) after every read. If so, it sets the boolinfile(bools defined in<stdbool.h>) to true.