Calling Python scripts from C/C++ program

srvalipe at hotmail.com srvalipe at hotmail.com
Mon May 8 12:51:25 EDT 2000


I am new to Python programming. I am writing a simple C++ application
that calls (embeds) a python script. I couldn't find good examples on
how to do this at www.python.org website.

The following is my python script:

def FibSeries(first=1, next=1, last=10):
	# return a list containing Fibonacci series:
	a, b = first, next
	result = []
	while b < last:
		result.append(b)
		print b
		a, b = b, a+b
	return result

I wrote a VC++ console application and trying to call the "FibSeries"
function from my main function.

Can anyone suggest me a clean/easy way to call python script function
and use the results in C++ program.

Also I need help on how to call C/C++ functions from Python scripts.

Any example code might be really helpful.

Thanks for your response(s).

Rao



Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list