in the following code, getch() is executed before the file is displayed.!
whats wrong? how can i correct this?
void ReadFile()
{ char fname[13],ch;
cout<<"Enter filename : ";
cin>>fname;
strcat(fname,".mth");
temp.open(fname,ios::in|ios::nocreate);
if(!temp)
{ cout<<"File does not exist!!!";
getch();
return;
}
temp.get(ch);
while(!temp.eof())
{ cout.put(ch);
temp.get(ch);
}
temp.close();
getch();
}