Using Python to grab output from a C++ program (thru cout)
<p>I have the following code in Python</p>

<pre><code>import subprocess
import time

info = subprocess.STARTUPINFO()
info.dwFlags |= subprocess.STARTF_USESHOWWINDOW
info.wShowWindow = subprocess.SW_HIDE

t1 = time.clock()
h = subprocess.Popen([r"C:\Users\MyName\Desktop\test.exe"], startupinfo=info) 
h.communicate()
t2 = time.clock()-t1

print "Return Code:", h.returncode
print "Duration:", t2
</code></pre>

<p>This works great if I am looking for the program's return code but what if I want to grab things that the program simply cout's to the screen and manipulate them as variables in Python?</p>
