The below program works fine for a input file that has only one line. but goes to an infinite loop for a multiline file. Kindly suggest.
#include<iostream.h>
#include<conio.h>
#include<fstream.h>
void main()
{
char data[10000];
int i=0;
ifstream ofile("c:\\temp\\welcome.txt");
cout<<"File opened\n";
// clrscr();
ofile.seekg(-1,ios::end);
while(1)
{
if(ofile.tellg()==-1)
break;
i++;
ofile.get(data[i]);
ofile.seekg(-2,ios::cur);
}
data[i]='\0';
cout<<data;
getch();
}//main