views:

1244

answers:

4

I need to execute a program and retrieve its stdout output in c++. I'd like my code to be cross-platform too.

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.

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.

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.

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?

A: 

Parts of Boost.Process are available in several stand-alone libraries in Boost now: Boost.Interprocess, Program Options, etc.

Kirill V. Lyadvinsky
+2  A: 

It looks like Boost.Process is in the sandbox area, which would suggest that it has been proposed for inclusion and is probably still being work on, but hasn't been deemed stable, documented and/or useful enough to be included in the main boost release.

Timo Geusch
+7  A: 

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.

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.

There is another version, by Ilya Sokolov.

For your other question:

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.

Depending on your needs, popen() could also do the job.

Éric Malenfant
+1  A: 

Another option might be the modularly designed POCO, see Process::launch() which has an overload that takes Pipes for in, out and error.

Georg Fritzsche