In a while(getline( my_input_file, my_string )) { loop, check if my_string.compare(0, test_string.length(), test_string) == 0 and cout << my_string; in that case.
It'll be a bit more ugly if you want to use char arrays.
See the reference on this site if you have any questions about the functions used