create a class to read and write to the file

Hi Guys,

I want to create a class to read and write to the file.
but I could not. Can you help me
1
2
3
4
5
6
7
8
9
10
11
12
13
14

class Myfile {
	fstream files;
public:
	Myfile(char *name)
	{
              openfile(name);
	}
		
           void openfile(char *name)
	{
	   files.open(name);
	}
};
I know the files, but How can I use in class.
Topic archived. No new replies allowed.