capture buffer output from a c++ system() command
问题 How would I capture the output from a php script that I run at the command line and store it to an array in c++? i.e. system('php api/getSome.php'); 回答1: Traditionally popen() is preferred when you need to IO between your parent and child process. It uses the C based FILE stream. It is a wrapper around the same low level intrinsics that also make up system(), namely fork + execl, but unlike system(), popen() opens a pipe and dups stdin/out to a stream for reading and writing. FILE *p = popen(