Original Post
Hi I really wish I could find the answer myself, but I couldn't get it from nowhere. So you guys are my only hope :(. Well I have one class and I want it to accept some kind of string and output it either to file,console or both.(Something like log):
Quote:Actually each log.Write should call my function pointer, which does additional actions with message, depending from selected mode. I have problem with overloading << operator, and with other possible versions. I want to call my function once the data is parsed into string, or somewhere else. But as I understand << works multiple times passing previous result to other argument. Thank you I hope some one can help me out with this.
//this is good choice - but not actually working with string rather with char* //and causes nasty exception when string is inserted as char*. // off course I can use c_str() - But I am looking for C++ way. log.Write("Data is = %s", data.Status()); //another way // This is a good way, but I can't seems to get it working log << "Data is =%s" << data.Status(); //and this method also - good but not working log.Write("Data is =",data.Status() ); //or log.Write("Data is =" << data.Status() );