[ create a new paste ] login | about

Link: http://codepad.org/v5OD0FbG    [ raw code | output | fork ]

C++, pasted on Aug 21:
#include<iomanip>
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
ifstream& openfile(ifstream &filename)

{
	string s ; 
	cout<<"Enter the file name";
    cin>>s;
	filename.open((s.c_str()));
	if (!filename.is_open())
	{
		cout<<"file not  open";
		filename.clear();
		system("PAUSE");

	}
	return filename;
	


}


int main()
{
	ifstream fmain;
	fmain= openfile(fmain);
	return 0;
	system("PAUSE");
}


Output:
1
2
3
/usr/local/lib/gcc/i686-pc-linux-gnu/4.1.2/../../../../include/c++/4.1.2/bits/ios_base.h: In member function 'std::basic_ios<char, std::char_traits<char> >& std::basic_ios<char, std::char_traits<char> >::operator=(const std::basic_ios<char, std::char_traits<char> >&)':
Line 781: error: 'std::ios_base& std::ios_base::operator=(const std::ios_base&)' is private
compilation terminated due to -Wfatal-errors.


Create a new paste based on this one


Comments: