I am using tcpstat in linux environment. I want to write his output in a C program, even if it is not finished yet. I tried using the popen () function, but it can only process the output after . I want to process tcpstat output on the fly when and when it prints it to standard output. How should I do it?
For instance,
$ tcpstat -i wlan0 1
Time:1297790227 n=2 avg=102.50 stddev=42.50 bps=1640.00
Time:1297790228 n=11 avg=86.36 stddev=19.05 bps=7600.00
Time:1297790229 n=32 avg=607.97 stddev=635.89 bps=155640.00
Time:1297790230 n=13 avg=582.92 stddev=585.55 bps=60624.00
The above conclusion continues indefinitely. So I want to handle the output in a C program, and when tcpstat prints something to stdout.
Thanks and respect,
Hrishikesh Murali
source
share