Emperor Sabi avatar

Multiple file line reading program (part 3).

learnandgrow

Published: 16 Jan 2018 › Updated: 16 Jan 2018Multiple file line reading program (part 3).

Multiple file line reading program (part 3).

Program body

#include iostream
#include string
#include fstream
using namespace std;

int main (){
ifstream file;
file.open("izuna.txt");
if(!file.is_open()){
cout<<"unable to load the file please check the directory"<<endl;
}else {
cout<<"File opened successfully!"<<endl;
string lines;
while(file.good()){
getline(file,lines);
cout<<lines<<endl;
}
}
return 0;
}

Working of program

this is multiple lines reading program of C++ in codeblocks!
x11.jpg
When you have the text file in that directory than this program will be executed else its gonna give, "unable to load the file please check the directory".

I hope you enjoyed and will learn more in future from learnandgrow@learnandgrow

Leave Multiple file line reading program (part 3). to:

Written by

SCIENTIST, Programmer,Photographer, Entrepreneur & Steemian .

Read more #programming posts


Best Posts From Emperor Sabi

We have not curated any of learnandgrow's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From Emperor Sabi