I have a .txt file which contains a continuous sequence of characters (without spaces). I wanted to search for a sequence of characters in the .txt file and am having trouble doing that.
ifstream fin;
fin.open("sample.txt");
while (!fin.eof())
{
ch = getchar();
if (ch == 'p' && ch + 1 == 'o' && ch + 2 == 'w')
std::cout << "Sequence found" << "\n";
}
fin.close();