Chinaunix首页 | 论坛 | 博客
  • 博客访问: 410424
  • 博文数量: 54
  • 博客积分: 1186
  • 博客等级: 少尉
  • 技术积分: 668
  • 用 户 组: 普通用户
  • 注册时间: 2011-03-11 04:57
文章分类

全部博文(54)

文章存档

2013年(1)

2012年(6)

2011年(47)

我的朋友

分类: C/C++

2011-05-12 11:53:02

  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. }



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

yuankk82016-04-05 16:34:57

实现的太漂亮了