On Mon, 10 Sep 2007 20:15:40 -0700, yagyala <[EMAIL PROTECTED]> wrote:
>Hi. I'm rtying to use pipes to communicate between a python GUI and a >spawned C++ program. I prefer not to use forking because the app may >be run on windows, where forking isn't supported. Roughly what I'm >doing is: > >(r,w) = os.pipe() >spawnl(P_WAIT, 'tool.exe', ' ', message, str(w)) >close(w) >print os.read(r, 1000) > >In c++ , >... >int main(int argc, char** argv) >{ > >} The 'subprocess' module provides an easier interface imo, eg: process = subprocess.Popen('tool.exe', stdin=subprocess.PIPE, stdout=subprocess.PIPE, universal_newlines=true) (self.outstream, self.instream) = (process.stdout, process.stdin) Daniel Klein -- http://mail.python.org/mailman/listinfo/python-list