I need to to create a stream output as like cout;
fout<<"number:"<<6<<endl;
will write everything to a file which i have specified or default.
I had came across friend ostream& operator << (ofstream& fout,ClassA &obj) etc. But I need to do as like 'QTextStream' in Qt how can i do that?
[QTextStream &operator<<(const QString &s);] FileStream &operator<<(const string &s);
It would make a lot more sense for the file to remain open, rather than you closing and reopening it for every write. Closing and reopening is very slow.
Also, what's the point of this FilesWriter class? Why not juse use ofstream directly?