How to print a sentence (including white spaces) from a file ?
Or
How to print entire text file which has a paragraph?
I have tried a lot and the final programs is shown below..
but it can't print sentences exceeding certain length...
it shows unwanted ASCII characters :(
How to overcome this problem?
#include<iostream.h>
#include<fstream.h>
#include<iomanip.h>
int main()
{
char msg[100];
ofstream ofile("Helloworld.txt");
cout<<"Enter a sentence: ";
cin.getline(msg,100);
ofile<<msg;
ofile.close();
ifstream ifile("Helloworld.txt");
cout<<"File contents:\n\n\n";
ifile>>msg;
cout.write(msg,30);
return 0;
}