Back to Alisql

Chapter 30. Boost.Process

extra/boost/boost_1_77_0/doc/html/process.html

latest1.5 KB
Original Source

| | Home | Libraries | People | FAQ | More |


Chapter 30. 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\>#include\<string\>#include\<iostream\>usingnamespaceboost::process;intmain(){ipstreampipe\_stream;childc("gcc --version",std_out\>pipe\_stream);[std::string](http://en.cppreference.com/w/cpp/string/basic_string)line;while(pipe\_stream&&[std::getline](http://en.cppreference.com/w/cpp/string/basic_string/getline)(pipe\_stream,line)&&!line.empty())std::cerr\<\<line\<\<std::endl;c.wait();}

|

Last revised: August 05, 2021 at 09:53:07 GMT

|

|