Hi, Thank u for the reply. My program is like this; int i; printf("?"); scanf("%d",&i);
python script: #!/usr/bin/env python import sys import os import time os.system("./a.out") os.system("2") output: ./prog.py ? ----> Waiting for input My input is given in the next line of the script.The control is waiting at the first line (os.system("./a.out")). How shall i do this ? -- Regards V.Murugadoss On Mon, Dec 14, 2009 at 2:10 PM, Noufal Ibrahim <nou...@gmail.com> wrote: > On Mon, Dec 14, 2009 at 10:04 AM, murugadoss <murugadoss2...@gmail.com > >wrote: > > > Hello, > > I am new to python scripting. I saw about subprocess module. I need to > > send an input to the running src,like > > > > eg: For adding two numbers > > 1. image running and waiting for input from user > > 2. input 1 > > 3. input 2 > > > > eg: > > ./add.src > > 2 > > 3 > > Can u please give me some more input how to pass there inputs > > > > You can write to the stdin of a running process. Did you look at the docs? > Check out the communicate method of the Popen objects. There's also this > that you might find useful > http://blog.doughellmann.com/2007/07/pymotw-subprocess.html > > -- > ~noufal > http://nibrahim.net.in > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers > _______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers