FILE HANDLING USING getline() FUNCTION IN C++

#include
#include
#include
Int main()
{
Char inputline[80],outputline[80];
Ofstream entryfile(“fewlines.dat”);
While(true)
{
Cin.getline(inputline,80);
If(!strcmp(inputline,”end”))
Break;
Entryfile<<
}
Entryfile.close();
Ifstream displayfile(“fewlines.dat”);
While(!displayfile.eof())
{
Displayfile.getline(outputline,80);
Cout<<
}
Displayfile.close();
Return 0;
}


Input:
It was a fight
 for pride
output:
it was a fight for pride

FILE HANDLING USING getline() FUNCTION IN C++ Reviewed by Rejin Paul on 6:07 PM Rating: 5

No comments:

Post Your comments,Views and thoughts Here, Give Us Time To Respond Your Queries

All Rights Reserved by Anna University UG PG Results 2016 May June © 2015 - 2018
Designed by RejinpaulTeam

Contact Form

Name

Email *

Message *

Powered by Blogger.