Calling a python script, and getting the returned result in C

sjdevnull at yahoo.com sjdevnull at yahoo.com
Wed Aug 16 18:00:32 EDT 2006


Shuaib wrote:
> Hi!
>
> I have a python script which returns an Integer value. How do I call
> this script from a C programe, and use the result returned?
>
> Thanks for your time.

This is actually a C question, not a Python question.

If all you need is the return value of the program, consider looking up
the system() call.  For more control, variations on popen and fork/exec
may be fruitful on Unix (presumably OS X too), or CreateProcess* on
MS-Windows.

For more detailed help, try comp.unix.programmer or
comp.os.ms-windows.programmer (or a similar newsgroup for whatever OS
you're using).




More information about the Python-list mailing list