这个函数怎么用?inet_addr

shilong 2003-04-23 12:22:12
char a[20];
strcpy(a,"1.2.3.4");
DWORD t=inet_addr(a);
wspritf("%x",t);
MessageBox(a);

郁闷得到的居然是: 04030201
倒过来了....
...全文
109 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
shilong 2003-04-23
  • 打赏
  • 举报
回复
MSDN上说
When four parts are specified, each is interpreted as a byte of data and assigned, from left to right, to the four bytes of an Internet address. When an Internet address is viewed as a 32-bit integer quantity on the Intel architecture, the bytes referred to above appear as "d.c.b.a''. That is, the bytes on an Intel processor are ordered from right to left.

但我想要顺着过来的数字,MFC库或API里有没有现成的函数
iProgram 2003-04-23
  • 打赏
  • 举报
回复
inet_addr只能把IP地址转换成标一连串数字那种IP地址
ksyou 2003-04-23
  • 打赏
  • 举报
回复
up

18,356

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 网络编程
c++c语言开发语言 技术论坛(原bbs)
社区管理员
  • 网络编程
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧