I saw the following code on boost::child documentation page where they explain how to read the output of a child process. http://www.boost.org/doc/libs/1_64_0/doc/h
boost::child
Another solution.
bp::child c(bp::search_path("nm"), file, bp::std_out > output, bp::std_err > error, svc);
This code ignores the order of stdout/stderr. If the order concerns, you can write like this:
bp::child c(bp::search_path("nm"), file, (bp::std_out & bp::std_err) > outerr, svc);