Word search from file to display whole line

Hi Guy!

I am trying write a small program which search word from text file and display a matched word whole line. Can any body help me out please?

Thank you,
Poor Guy
You can use an ifstream to get input from files, and use the getline() function to get each line one at a time from the file. Then simply search the line you retrieved for the word you are looking for - if you find it, just print out the line.

ifstream: http://www.cplusplus.com/reference/iostream/ifstream/
getline: http://www.cplusplus.com/reference/iostream/istream/getline.html
Topic archived. No new replies allowed.