问题描述
我需要执行一个程序并在 C++ 中检索它的 stdout 输出.我也希望我的代码是跨平台的.
I need to execute a program and retrieve its stdout output in c++. I'd like my code to be cross-platform too.
最近发现了 Boost c++ 库的奇妙世界,可以满足您所有的跨平台需求,我想我应该去 boost.org 并阅读 Boost.Process 的文档.令我惊讶的是,它不在那里!然后我开始弄清楚 Boost 给他们的跨平台库起什么名字来启动外部进程,但到目前为止还没有找到.
Having recently discovered the wonderful world of the Boost c++ libraries for all your cross platform needs, I figured I'd just go to boost.org and read up on the documentation of Boost.Process. Much to my surprise, it wasn't there! I then proceeded to figure out what name Boost gave their cross-platform library to start external processes, but haven't managed to find it so far.
通过 Google 搜索,我找到了 Julio M. Merino Vidal 的 Boost.Process,其中似乎是我正在寻找的非官方 Boost 库.奇怪的是,我似乎无法在该网站上找到下载链接.该项目最近似乎也没有任何进展.
A Google search brought me to Julio M. Merino Vidal's Boost.Process, which seems to be the unofficial Boost library I was looking for. Strangely enough, I cannot seem to find a download link on that website. It also seems like there haven't been any recent developments regarding the project.
我终于能够在外部网站 并且现在将使用它,但我非常惊讶我必须付出努力才能获得跨平台 C++ 库以与外部进程交互.
I was finally able to find a download link for Vidal's Boost.Process on an external site and will use that for now, but I'm quite amazed at the effort I had to put in to get my hands on a cross platform c++ library to interact with external processes.
那么,为什么没有官方的Boost.Process?这似乎是一个非常有价值的补充.还是我完全忽略了这里明显的解决方案?您能否推荐其他跨平台库来管理外部流程的简单启动和交互?
So, why is there no official Boost.Process? It seems like it would be a very valuable addition. Or am I totally overlooking the obvious solution here? Could you perhaps suggest other cross-platform libraries for managing simple starting of and interation with external processes?
推荐答案
Julio M. Merino Vidal,我相信,原作者,在 这篇 2007 年的帖子,他没有时间完成.
Julio M. Merino Vidal, who is, I beleive, the original author, wrote in this 2007 post that he did not have time to complete it.
开发由 Boris Schaeling 接管.这是您在 http://www.highscore.de/boost/process/ 上找到的版本一>.根据这个帖子,他仍在积极开发它.
Development was taken over by Boris Schaeling. This is the version that you found at http://www.highscore.de/boost/process/. According to this post, he is still actively developing it.
还有另一个版本,作者是 Ilya Sokolov.
There is another version, by Ilya Sokolov.
对于您的其他问题:
您能否推荐其他跨平台库来管理外部进程的简单启动和交互?
Could you perhaps suggest other cross-platform libraries for managing simple starting of and interation with external processes?
您可以查看此维基页面列表替代方案.
you could look at this wiki page listing alternatives.
根据您的需要,popen() 也可以完成这项工作.
Depending on your needs, popen() could also do the job.
这篇关于Boost.Process 在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!