Capturing stdout from a system() command optimally [duplicate] April 5, 2023 by Tarik From the popen manual: #include <stdio.h> FILE *popen(const char *command, const char *type); int pclose(FILE *stream);