Horje
search a word in cpp file Code Example
search a word in cpp file
#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");
}




Cpp

Related
clean list widget qt Code Example clean list widget qt Code Example
what is ++i and i++ Code Example what is ++i and i++ Code Example
Time complexity Code Example Time complexity Code Example
pum game in c++ Code Example pum game in c++ Code Example
c++ loop through array Code Example c++ loop through array Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9