I want to create a class for I/O operations. This class take filename as parameter and then provides functions to write and read from file. I had to include two different fstream objects,one for input and one for output ,so I designed such an implementation.If you can see a better approach or improve my design ,please tell me...
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
class FileHandler
{
public:
FileHandler(char *);
~FileHandler();
char* getFileName()const;
void setFileName(char *);
void openFileToRead();
char* readLine();
void openFileToWrite();
void writeLine(char *);
void closeFile();
private:
char* fileName;
ofstream fout;
ifstream fin;
};