#include <iostream> #include <string> #include <fstream> 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"); }
cout << line;
line
string
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)