Results 1 to 3 of 3
i want to compare with command line
system("arp -en | grep eth1 | wc -l"); --> result about = 4
compare with
system("arp -en | grep eth0 | wc -l"); ...
- 06-19-2007 #1Just Joined!
- Join Date
- Jun 2007
- Posts
- 84
anyone help me!! i want compare system call with c programing.
i want to compare with command line
system("arp -en | grep eth1 | wc -l"); --> result about = 4
compare with
system("arp -en | grep eth0 | wc -l"); --> result about = 10
** i want to compare result (integer) command between command1 and command2
How to programing with C on linux.
- 06-19-2007 #2
- Lakshmipathi.G
-------------------
FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
-------------------
- 06-19-2007 #3Linux Enthusiast
- Join Date
- Aug 2006
- Posts
- 631
You can accomplish this with the popen() function. An example of popen():
RegardsCode:#include <stdio.h> main() { FILE *fp; char line[128]; fp = popen("arp -en | grep eth1 | wc -l", "r"); while ( fgets( line, sizeof line, fp)) { printf("%s", line); } pclose(fp); }


Reply With Quote
