#include <iostream>
#include <fcntl.h>
#include <fstream>
using namespace std;
class Logger
{
private:
ofstream debug;
Logger()
{
debug.open("debug.txt");
}
static Logger log;
public:
static Logger getLogger()
{
return log;
}
void writeToFile(const char *data)
{
debug << data;
}
void close()
{
debug.close();
}
};
Logger Logger::log;
Through this class i m trying to create a Logger class which logs into a file. But it gives error like
error: ‘std::ios_base::ios_base(const std::ios_base&)’ is private
i googled it and found that its because of copying ofstreams. As far as i understand in this code no copying of ofstreams is taking place.
Can u guys help me out. Thanks in advance.
~