Hi guys,
I've compiled the code given below which allows the user to enter the address of a text file and then view it(the whole thing). But, as soon as input is taken,
"openfile.exe has encountered a problem and needs to close. Send Error Report."
When I Press Debug
something in assembly language pops up.
#include <iostream.h>
#include <fstream.h>
int main()
{
char *fname=0;
cin >> fname;
ifstream OpenFile(fname);
char ch=0;
while(!OpenFile.eof())
{
OpenFile.get(ch);
cout << ch;
}
OpenFile.close();
}
Can anyone please mention the error?
Constructive Suggestions Appreciated.
Cheers,
Anurag