Search a particular string in a file

The task is that I need to create a file in which I have to put some text. Then I have to read that file and search for a particular string. If it finds that then some operations have to be performed else not found should be printed.
I am confused as to which function to use to search for a string. Some that I am trying are but not able to use properly are find() , compare () etc.
Which function would be suitable for finding a string in a file?
Can anyone help in this regard?
Any working example would help a lot!!
Last edited on
You need to read (some of) it into memory and do your search on that.
Topic archived. No new replies allowed.