C# has this nice Process.OutputDataReceived() method that occurs when each time the process write a line to stdout, and for some reason I need this implementation in C++, for Windows only. I tried boost::process with async io, something like
boost::asio::async_read(ap, boost::asio::buffer(buf),
[&](const boost::system::error_code& ec, std::size_t size)
{
std::cout << buf.data() << '\n';
});
However the callback only happens once, and won't continue if the buffer is not big enough. I want the functionality that it keeps on "monitoring" the child process until it exits.