I have seen a post link where a user replies for the dynamic allocation of the popen output.
For convenience, I paste the code here.
void save_cmd(int