文件名称:getIP-impro
- 所属分类:
- Linux/Unix编程
- 资源属性:
- [C/C++] [源码]
- 上传时间:
- 2012-11-26
- 文件大小:
- 6kb
- 下载次数:
- 0次
- 提 供 者:
- quie*****
- 相关连接:
- 无
- 下载说明:
- 别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容均来自于网络,请自行研究使用
本程序用户获取主机的IP地址和MAC地址,头文件与函数原型如下
#include "getIP.h"
int get_ip(char *ipaddr, char *netmask, const char *ethname)
#include "getIP.h"
int get_mac(char *mac)
以下是get_ip函数简单使用范例
//定义IP和MAC所需要的存储空间
char ethname[] = "eth0"
char ipaddr[20] //IP地址最长为16个字符
char netmask[20] //子网掩码最长为18个字符
//获取IP地址
get_ip(ipaddr,netmask,ethname)
//输出结果
printf(" s\n",ipaddr)
printf(" s\n",netmask)
以下是get_mac函数简单使用范例
-The program user access to the host' s IP address and MAC address, the following function prototype header file# include " getIP.h" int get_ip (char* ipaddr, char* netmask, const char* ethname) # include " getIP.h" int get_mac (char* mac) use the following simple example is get_ip function// define the IP and MAC need storage space char ethname [] = " eth0" char ipaddr [20] // IP address of up to 16 characters char netmask [20] // mask for up to 18 characters// Obtain an IP address get_ip (ipaddr, netmask, ethname) // output printf (" s \ n" , ipaddr) printf ( " s \ n" , netmask) use the following simple example is get_mac function
#include "getIP.h"
int get_ip(char *ipaddr, char *netmask, const char *ethname)
#include "getIP.h"
int get_mac(char *mac)
以下是get_ip函数简单使用范例
//定义IP和MAC所需要的存储空间
char ethname[] = "eth0"
char ipaddr[20] //IP地址最长为16个字符
char netmask[20] //子网掩码最长为18个字符
//获取IP地址
get_ip(ipaddr,netmask,ethname)
//输出结果
printf(" s\n",ipaddr)
printf(" s\n",netmask)
以下是get_mac函数简单使用范例
-The program user access to the host' s IP address and MAC address, the following function prototype header file# include " getIP.h" int get_ip (char* ipaddr, char* netmask, const char* ethname) # include " getIP.h" int get_mac (char* mac) use the following simple example is get_ip function// define the IP and MAC need storage space char ethname [] = " eth0" char ipaddr [20] // IP address of up to 16 characters char netmask [20] // mask for up to 18 characters// Obtain an IP address get_ip (ipaddr, netmask, ethname) // output printf (" s \ n" , ipaddr) printf ( " s \ n" , netmask) use the following simple example is get_mac function
(系统自动生成,下载前可以参看下载内容)
下载文件列表
getIP-impro\getIP
...........\getIP.c
...........\getIP.h
...........\getIP.o
...........\main.c
...........\main.o
...........\readme
...........\代码说明.txt
getIP-impro
...........\getIP.c
...........\getIP.h
...........\getIP.o
...........\main.c
...........\main.o
...........\readme
...........\代码说明.txt
getIP-impro