VC中IP控件字符串IP的赋值与取值

来源:互联网 发布:matlab求矩阵特征向量 编辑:程序博客网 时间:2024/04/20 02:27

//把CString表示的IP地址写到IP Address里面

CString strIP="192.168.0.17";

DWORD dwIP=ntohl(inet_addr(strIP));

 m_IP.SetAddress(dwIP);

//读取IP Address的内容.

DWORD dwIP;

 IN_ADDR ia;

 CString strIP;

 m_IP.GetAddress(dwIP);

 ia.S_un.S_addr=htonl(dwIP);

strIP=inet_ntoa(ia);

 

 本篇文章来源于:开发学院 http://edu.codepub.com 原文链接:http://edu.codepub.com/2009/0616/6405.php