This is very old and probably largely wrong by now, but the general concept is the same.

http://www.respower.com/~earlye/programming/19991206.001.htm

Basically, you need to create a streambuf class that calls PySys_WriteStdout() inside your_streambuf_class::sync().

-- Early Ehlinger

On Mon, May 11, 2009 at 11:11 AM, Dietrich Bollmann <diresu@web.de> wrote:
Hi,

I would like to print from C++ to the same stream as Python's 'print'
command does.  I am using an embedded Python shell and when using
std::cout nothing is printed at all...

Currently I am using the following code:

 std::ostringstream oss;
 oss << "test\n";
 std::string cs = oss.str();
 PySys_WriteStdout(cs.c_str());

I wonder if there is an easier way to get the same result?

Thanks, Dietrich


_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users



--
Early Ehlinger