From: thooney at pk.highway.ne.jp (Thooney Millennier)
Date: Tue, 27 Apr 1999 00:24:57 +0900
Subject: To redirect stdin,out
Message-ID: <37248549.6AD365AC@pk.highway.ne.jp>
X-UID: 813                                                  

Hello,everyone.

I want to redirect standard input and output
to my C++ stream object and 
use something like PyRun_InteractiveLoop().

It seems we can redirect standard output by ...
(quoted from http://www.python.org/doc/FAQ.html)

      class StdoutCatcher:
        def __init__(self):
          self.data = ''
        def write(self, stuff):
          self.data = self.data +stuff
          ToCppObject(self.data)  #pass data to
C++ object

      import sys
      sys.stdout = StdoutCatcher()
      print 'foo'

I am at a loss how to redirect standard input.
If you know any solutions,Please Help!


Thanks for reading.

Thooney Millennier




