Stopping file input when a certain word is encountered

I'm working on a c++ program that is supposed to eventually be like history in google , i mad my self some fake address and a now i need to take certain word from the text so its like this:
1,1,2019,1,1, http://,bh1-6,org
2,1,2019,2,2, https://,bh2-7,org
3,1,2019,3,3, http://,bh3-8,org
4,1,2019,4,4, http://,bh4-9,org
5,1,2019,5,5, http://,bh5-10,org
.
.
.
The numbers are like date and time but i need the address.
just stop the loop.
presumably you are reading in a loop, with a getline or << or something?
add a Boolean condition to that loop to stop.
eg
string s = "";
while(s!="magic words" && file.getline(s))
{
more_code();
}

Topic archived. No new replies allowed.