我有一个 C++ 可执行文件,用于眼动仪,printf 的注视坐标指向终端。我需要能够将这些放入 Python 中以进行数据分析等。如果有一种方法可以实时执行此操作,那么我就可以在 Python 中操作传入的数据,那就太棒了。我发现最有用的东西是:http://fluxtrap.blogspot.co.uk/2011/09/dead-simple-real-time-plotting-with-cc.html .然而,这似乎是针对 UNIX 的,而我在 Windows 上。所以我的问题是,是否有类似的技术可以让我运行我的 C++ 程序并在 Python 中使用它的数据?
最佳答案
However this seems to be for UNIX, and I'm on Windows. So my question is, is there a similar technique such that I can run my c++ program and use it's data in Python??
如前所述here Windows cmd.exe
shell(和 powershell 也)支持 |
符号的方式与 linux/unix shell 相同。
有一点特别(对于两种操作系统)是您需要显式调用 python 解释器。所以像这样运行你的东西
mycppprogram | python mypyscript.py
应该努力实现你想要的。
关于python - 从 C++ exe 中获取输出并在 Python 中实时处理它,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42073501/