[C++-sig] console I/O
Alan Baljeu
alanbaljeu at yahoo.com
Mon Nov 24 22:44:26 CET 2008
Thanks Scott. I found a very complete example based on that:
http://www.ragestorm.net/samples/empython.zip
Alan Baljeu
----- Original Message ----
From: Scott VanSickle <Scott.VanSickle at CanfieldSci.com>
To: Development of Python/C++ integration <cplusplus-sig at python.org>
Sent: Monday, November 24, 2008 3:02:20 PM
Subject: Re: [C++-sig] console I/O
Alan,
We execute Python code in our integration to redirect its stdout; sys.stdout is the where the output of its print method goes by default. We use a wrapped Python object on Windows that sends output via OutputDebugString; but you can send your output wherever you want. You basically just need a Python object with a write method to accomplish this. Create your Python object, then just reassign sys.stdout early in your implementation code like this:
sys.stdout = YourClass()
Scott V
Lead Software Architect
Canfield Imaging Systems
Fairfield, NJ
-----Original Message-----
From: cplusplus-sig-bounces+svansickle=canfieldsci.com at python.org [mailto:cplusplus-sig-bounces+svansickle=canfieldsci.com at python.org] On Behalf Of Stefan Seefeld
Sent: Monday, November 24, 2008 2:49 PM
To: Development of Python/C++ integration
Subject: Re: [C++-sig] console I/O
Alan Baljeu wrote:
> I followed the directions there, but that is incomplete. I can printf from C to the console, but print from Python does nothing. Something in the Python API must be employed. But perhaps I should take this to the main Python list.
>
Definitely.
Regards,
Stefan
--
...ich hab' noch einen Koffer in Berlin...
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig at python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
__________________________________________________________________
Ask a question on any topic and get answers from real people. Go to Yahoo! Answers and share what you know at http://ca.answers.yahoo.com
More information about the Cplusplus-sig
mailing list