How to retrieve program output as soon as it printed?
问题 I have a boost::process::child. There are many examples on how to get all its stdout or stderr in a single vector, but in this method you capture all data at once. But how to retrieve lines/characters as soon as they are printed in child process? 回答1: The docs are here: Synchronous IO Asynchronous IO Using ipstream The simplest way: Live On Coliru #include <boost/process.hpp> #include <iostream> namespace bp = boost::process; int main() { std::vector<std::string> args { "-c", R"--(for a in