i posted this problem in C++ forum and people told me its impossible.
I'm using a very old version of C++ and most of its features are very similar to C.
So i thought maybe you people will understand what the problem is....


In the following code, getch() is executed before the file is displayed.

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();
}

you can find the thread i've posted in C++ forum at
http://www.daniweb.com/forums/thread103115.html

i've posted there the exe file i got after compiling the program containing this function and how to get this error un that program.

This is C++, so I'll answer your question in the C++ forum and close this thread.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.