Reputation: 29
How can I print and entire text file in c++ without showing the blank lines between entries. for example I have a text which contains the data below :
ID: 01 FName: Andy Lname: Garcia
//this line is left blank
//this line is left blank
//this line is left blank
ID: 02 FName: Brad Lname: Pitt
Now I want to print the entire text file and I usually use while loop for that. But this time I want the program to skip these blank lines. One of the reasons why I want this to happen is that, I have separated the eateries by adding a : "Next" << endl; , this "Next" appears after each line when the program prints out the file but because there are so many blank line, it also prints so many Next one after another.
I would really appreciate any instructions. Thank you
Upvotes: 1
Views: 281
Reputation: 755094
The necessary code is simple:
Upvotes: 4