I'm trying to do some parsing on netstat's output, but this is proving rather difficult...:
So far, popen() has me baffled. As far as I can tell from the snippit below, popen is returning NULL, and errno is set to zero. (Which makes no sense.) What is going on here?
Code:
ph = popen("netstat -e", "r");
if(!ph)
{
sprintf(err, "Error is %d. ph = %d\n", errno, ph);
MessageBox(HWND_DESKTOP, "popen failed.", "popen", MB_OK);
MessageBox(HWND_DESKTOP, err, err, MB_OK);
return;
}
(function continues..., or would, if popen() would succeed...)
Since all I really care about is the bytes sent & recv'd... is there an easier way to get those numbers? Some API call I know nothing about?