Interface with C

Terry Hancock hancock at anansispaceworks.com
Wed Sep 14 18:47:29 EDT 2005


On Wednesday 14 September 2005 12:34 pm, Ben Pearson wrote:
> I have a program that is developed in C, that has a simple text 
> interface. I would like to use the same program, but with a GUI. I 
> would like to use Python to interface with it, so that Python will 
> simply read and write the code that would be used from a normal user, 
> but using a TK GUI. For example, in the C program, if you type 0, it 
> will send a ping. I would like to build a program that will run the C 
> program, simply inputing the values that the Text interface would 
> use, but with the graphical interface. EI, the following should work.

If you are asking what I think you're asking, you need
to read up on the "subprocess" module (Python 2.4). There
are ways to do it with earlier versions, but everything I've
heard about this (and personal experience with the old way)
suggests you should just use 2.4's subprocess.

What I thought you said is that your C program runs its own
control loop, taking data from stdin and acting on it, presumeably
outputting to stdout if necessary.

Cheers,
Terry

--
Terry Hancock ( hancock at anansispaceworks.com )
Anansi Spaceworks  http://www.anansispaceworks.com




More information about the Python-list mailing list