Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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");
}
Comment

PREVIOUS NEXT
Code Example
Cpp :: how to make a list in c++ 
Cpp :: ue4 c++ enumaeration 
Cpp :: SetUnhandledExceptionFilter 
Cpp :: if vector is empty c++ 
Cpp :: max element in array c++ stl 
Cpp :: Resize method in c++ for arrays 
Cpp :: change integer to string c++ 
Cpp :: cpp multidimensional vector 
Cpp :: find primes in a range in c++ 
Cpp :: vector search by element 
Cpp :: udo apt install dotnet-sdk-5 
Cpp :: convert string toupper and tolower in cpp 
Cpp :: count number of set bits C++ 
Cpp :: c++ isalphanum 
Cpp :: hamming distance c++ 
Cpp :: declaring 2d dynamic array c++ 
Cpp :: reverse function in cpp string 
Cpp :: c++ inherit from class template 
Cpp :: int max c++ 
Cpp :: how to use cout function in c++ 
Cpp :: built in function in c++ for binary to decimal 
Cpp :: sina + sinb formula 
Cpp :: anagram solution in c++ 
Cpp :: getline(cin string) not working 
Cpp :: card validator c++ 
Cpp :: cpp class constructor 
Cpp :: descending order c++ 
Cpp :: mac emoji shortcut 
Cpp :: c++ Least prime factor of numbers till n 
Cpp :: maxheap cpp stl 
ADD CONTENT
Topic
Content
Source link
Name
5+8 =