I'm trying to parse the output of fping in my program, but the second line of the output, is always going directly to my standard output. So if the output of fping is:
x.x.x.x : [0], 84 bytes, 1.98 ms (1.98 avg, 0% loss)
x.x.x.x : xmt/rcv/%loss = 1/1/0%, min/avg/max = 1.98/1.98/1.98
then I'm not able to read this second line in my program.
My code looks like this:
Code:
M_fp = popen("fping -c 1 -t2000 x.x.x.x","r");
fread(buffer,1, 1000, M_fp);
So the first line will be in my buffer and the second line is shown in my shell.
How can I get both lines in the buffer, or at least make that the second line is not shown in the buffer?