how to get ip address of my computer
- by asthagoyal
hello i want to get ipaddress of my computer in variable ip thru this code
but it assign nothing in ip
char comm[100];
int s=0;
char ip[100];
sprintf(comm,"export ip=`/sbin/ifconfig eth0 | grep 'inet addr:' | cut -d: -f2 | awk '{ print $1}'`");
s=system(comm);
printf("\n ip is %s",ip);