| Home | Libraries | People | FAQ | More

## Chapter 29. Boost.Process

### Klemens David Morgenstern

Copyright © 2006-2012 Julio M. Merino Vidal, Ilya Sokolov, Felipe Tanus, Jeff Flinn, Boris Schaeling

Copyright © 2016 Klemens D. Morgenstern

Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

## Introduction

Boost.Process is a library to manage system processes. It can be used to:

- create child processes
- setup streams for child processes
- communicate with child processes through streams (synchronously or asynchronously)
- wait for processes to exit (synchronously or asynchronously)
- terminate processes

Here's a simple example of how to start a program with Boost.Process:

    #include <boost/process.hpp>

    using namespace boost::process;

    int main()
    {
        ipstream pipe_stream;
        child c("gcc --version", std_out > pipe_stream);

        std::string line;

        while (pipe_stream && std::getline(pipe_stream, line) && !line.empty())
            std::cerr << line << std::endl;

        c.wait();
    }

Last revised: April 22, 2020 at 13:42:30 GMT |