Question regarding while getline loop (simple)

Hey all. So I'm just curious if there's a better way to exit this while loop when reading in a string. Essentially, this is how I did it

1
2
3
4
5
6
7
8
9
10
11
12
13
14
		while(getline(cin, title)){
			if(title == "")
				break;
			getline(cin, url);
			getline(cin, comment);
			cin >> length;
			cin >> rating;
			cin.ignore();
			list[count] = new Video(title, url, comment, length, rating);
			cout << list[count] << endl;
			cout << &list[count] << endl;
			list[count]->print();
			count++;
		}


I'm just curious if there's a more streamlined way to do so though. Cause at first I thought simply the while(getline(cin, title)) would do it, but then realized that even a blank line would be read in, thus it would never exit the loop. Any better way to do so would be most appreciated

Cheers
:D
1
2
while(getline(cin, title) && title.length())
{ ... }
tyty
:D
Topic archived. No new replies allowed.