You could use system("netstat -e > output.txt") and then read in output.txt.