Chinaunix首页 | 论坛 | 博客
  • 博客访问: 222228
  • 博文数量: 61
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 22
  • 用 户 组: 普通用户
  • 注册时间: 2015-01-11 20:47
文章分类
文章存档

2017年(3)

2016年(11)

2015年(47)

我的朋友

分类: C/C++

2015-01-28 16:49:27

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <sys/socket.h>

  4. int iptoint( const char *ip )
  5. {
  6.     return ntohl( inet_addr( ip ) );
  7. }

  8. void inttoip( int ip_num, char *ip )
  9. {
  10.     strcpy( ip, (char*)inet_ntoa( htonl( ip_num ) ) );
  11. }



阅读(2155) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~