How can I get in my 开发者_开发技巧linux machine the network service status (like service network status in terminal) from C++?
You'll probably want to use a call like exec or execv
. They're available if you include "unistd.h" . For more information on how they work, either look at the man page for exec with man exec
or look here:
system can also be used. Like -
#include <stdlib.h>
int main() {
system("ls -l");
printf("This is a directory list...");
}
you can use iftop command to find network stats in linux.
精彩评论