<div dir="ltr"><div><div><div><div>Hi,<br><br></div><div>this is somehow a general C++ question, but it could be of interest to all Rcpp users (I think).<br><br></div>Still for the purpose of RcppOctave, I would like to redirect cout and cerr streams that are used by Octave to Rprintf REprintf respectively. <br>
Currently I redirect these streams to 2 temporary stringstreams (via the std::cout.rdbuf get/set methods ) which buffer the output/errors messages and print them at the end of the Octave call. The standard streams are restored on exiting the function (in a class destructor).<br>
<br>However, I would like to do this without buffering, i.e. that messages are printed as they come through the stream. This should be possible through the definition of a std::stream child class with some method overload that output the formatted messages as they are pushed into the stream.<br>
<br></div>Anybody knows which class and method(s) need to be overloaded, or have hints on how to achieve this in an -- aesthetic -- way?<br><br></div>Thank you.<br><br></div>Bests,<br>Renaud<br></div>