Hi All,
I am a newbie in C++. Lately I want to write a program to process the Logs which are in the following format
----some unwanted line---
----some unwanted line---
Enter:1
--Lines to be processed--
--Lines to be processed--
--Lines to be processed--
Exit
----some unwanted line---
----some unwanted line---
Enter:2
--Lines to be processed--
--Lines to be processed--
--Lines to be processed--
Exit
----some unwanted line---
----some unwanted line---
I want to process only the lines between Enter and Exit. Somehow I can manage toget to the line Enter. But my question is..
Is there a general way or an approach to solve this problem. How can I filter only the lines between the Enter and Exit removing all other unwanted lines??
open file
keep getting one line each till not eof
see if it has enter
if yes then start processing the data
else keep reading the lines
if you are in enter state then see if its exit
if yes then stop processing the data
else keep processing the data.