In your code you can use the system function.
Consider that you are searching for the "the" keyword from that opened text file
So you can use like follows

system("grep the file_name");

So the system function will execute the grep command and it will search for the key word from that specified file.

Using this you can find the keyword from that file