Reading Multiple lines skip-over

Hey! I'm reading a file, and I set up this code:

1
2
3
4
5
6
7
8
9
10
11
fstream target;
target.open("C:\\Users\\Tim Hanewich\\Documents\\TextHere.txt");
string str;
do
{
	getline(target, str);
	cout<<str<<"\n";
} while (getline(target, str));
cout<<"\n\n\n\nDone!";
cin.get();


Now, for some reason, which I cant figure out, it only "couts" line1, line3, line5, line7, and so on...

Why is this happening? Thanks guys! :-)
closed account (3hM2Nwbp)
ifstream::getline is being called twice in your loop.
Okay, I think i got it now. Thanks man!
Topic archived. No new replies allowed.