python - 从 C++ exe 中获取输出并在 Python 中实时处理它

标签 python c++ real-time stdout change-data-capture

我有一个 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/

相关文章:

android 媒体编解码器 : real time decoding h264 nals

javascript - 对两个不同的页面使用相同的端口

python - python读取多个文件

python - 10 分钟了解 Pandas 教程 - to_numpy() 不存在?

c++ - 这里需要内存栅栏吗?

architecture - 使用 Erlang/OTP 构建容错软实时 Web 应用程序

Python Bottle SSE

python - Scrapy 在几页后停止爬行

c++ - 如何将 mpl::set 的内容扩展为函数模板的模板参数

c++ - 传递对指针的引用