#include #include #include using namespace std; int main() { ifstream input; size_t pos; string line; input.open("t.txt"); if(input.is_open()) { while(getline(input,line)) { pos = line.find("hey"); if(pos!=string::npos) // string::npos is returned if string is not found { cout <<"Found!"; break; } } } system("pause"); }