Everytime, std::cout
is used from the main function or other functions, I want to copy the contents of a logfile to a Fltk GUI Window.
I've implemented a function which does the copying part. I want to know if its possible to make this function run every time std::cout
or maybe, std::endl
is executed in the code.
How can I implement this?
EDIT: For more clarification,
The function which needs to run every time is:
void printProgress(const std::string& strProgress)
{
std::ostringstream strResultTextStream;
strResultTextStream << m_pLogOutput->value();
strResultTextStream << strProgress;
m_pLogOutput->value(strResultTextStream.str().c_str());
}
Adding data to the output window (fl_multiline_output) requires the 4 lines of code above. Right now I have redirected the standard output messages to a log file. I wanted to run this function everytime to copy the contents of the logfile to m_pLogOutput(the Output window)