i need help on how to search for a sentence inside a txt file after opening it and then applying a condition if that sentence was found.
im a beginner so i don't know how.
basically i have written a program that uses system("command>file.txt") to start a command line process and write the output to a file , and what i want is to search for a certain line in the output (an error message for example) and force the program to act upon the condition of it being found.
string sentencetolookup="error connecting to server"; system("command>output.txt");
i want to know how to look for "sentencetolookup" inside the "output.txt" file and if found force the program to stop or return an error message.
any help is appreciated