R
ravi
Folks,
I have a heterogenous env. where I developed some C++ code. This code
has the '<<' operator overloaded
to pretty print classes.
This set of classes are instantiated in code which has a constraint on
how to print msgs. (the msgs go to
stdout as well as one or more log files etc. and is controlled by
other factors like brevity of logs etc. Let us
call this function printLog(arg, "format", ...);
What I would ideally like is...
replace 'cout' with 'xout'.
Use xout as always xout << pobj << pobj2 << endl;
Some how get access (readonly is fine) to the formatted string
const char* p = xout.getString() (???)
printLog (args, "%s", p);
Question is how to extract the formatted string from a stream object.
Any help appreciated.
-ravi
I have a heterogenous env. where I developed some C++ code. This code
has the '<<' operator overloaded
to pretty print classes.
This set of classes are instantiated in code which has a constraint on
how to print msgs. (the msgs go to
stdout as well as one or more log files etc. and is controlled by
other factors like brevity of logs etc. Let us
call this function printLog(arg, "format", ...);
What I would ideally like is...
replace 'cout' with 'xout'.
Use xout as always xout << pobj << pobj2 << endl;
Some how get access (readonly is fine) to the formatted string
const char* p = xout.getString() (???)
printLog (args, "%s", p);
Question is how to extract the formatted string from a stream object.
Any help appreciated.
-ravi