I intend to call a function whenever m_logger<<"hello"<<"world"
is called. m_logger is of type ofstream.
So i decide to overload << with following signature
friend ofstream& operator<<(ofstream &stream,char *str);
However the vc compiler gives following error:
error C2666: 'operator <<' : 6 overloads have similar conversions
Is there anyother way to achieve this, my objective is to divert all the write operation to ofstream object to different function?
Creating an object of my own calss works for me, however how can i make it work like normal ofstream object which typecasts all system defined types into strings or char*. i know one approach would be to overload the operator for each and every type but is there a cleaner approach