首页 > 编程知识 正文

linux编程,知道ip和子网掩码怎么求网络地址

时间:2023-05-03 17:23:16 阅读:148455 作者:4228

在Linux上执行以下步骤: # include stdio.h # include stdlib.hint main () file * netinfo=popen ((/sbin/ifconfig ),' r ' ); if (! netinfo ) {puts(errorwhileopenpipe ); exit(1; } char str[200]; wile(fgets(str,199,netinfo )!=NULL ) {printf('%s ',str ); }pclose(Netinfo ); }htdhb [root@localhost ~]# ./testeth0link encap :以太网hwaddr 0033600 c 33602933604:6 FB :6 d inetaddr 3360192.168.232.128 bcast 3360192.168.255 0c:29ff:Fe44:FB6d/64 scope : linkupbroadcastrunningmulticastmtu :1500 metric 33601 rx packets 33600 dropped :0 over runs 33600 fram mer 00 dropped :0 over runs :0电信公司:0 collisions 33600 txqueuelen 33601000 rx bytes 33607666 (7.4 kib tx bytes :6087 (5.9 kib ) interrupt :18 base address :0 x 2024 lolinkencap : localloopbackinetaddr 3360127.0.0.0.1 mask 33:255.0.0.0.0.0 inet6addet 6 tu :16436 metric :1 rx packets :1706 errors 33600 dropped :0 over runs 33600 frame 336000 3606 errors :0 droped :0 over olli sions :0 txqueuelen :0 rx bytes 33602640180 (2.5 MIB ) txbbb

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。