There are several ways, depending on your taste.
First, if you want the output to go to the console
and to the program, you can do this:
Code:
system("service dhcpd status | tee tempfile.txt");
and then read file
tempfile.txt in your program.
Another way would be to do I/O redirection by hand, using
fork(),
exec(), and other calls. Effectively, your program would do much of what
bash or other shells do. To get started, go here:
http://www.gnu.org/software/libc/man...scriptors.html
http://www.gnu.org/software/libc/man...Launching-Jobs
These pages are intended for C users, but C++ users will find them interesting also.
Hope this helps.