您的位置:首页 > 其它

mfc IP控件ip地址转unsigned long和unsigned long转char*

2014-05-29 14:19 405 查看
<pre name="code" class="cpp">	BYTE nField0 = 0, nField1 = 0, nField2 = 0, nField3 = 0;
UpdateData(true);
CString ipaddr;
if(!m_zhongip.IsBlank())
{
m_zhongip.GetAddress(nField0, nField1, nField2, nField3);
ipaddr.Format(_T("%d.%d.%d.%d"), nField0, nField1, nField2, nField3);
zhongip.ip=inet_addr(ipaddr);
/*
unsigned long ulAddr = zhongip.ip;
in_addr inaddr;
inaddr.s_addr=ulAddr;
char* pAddr = inet_ntoa(inaddr);
*/
}

else
{
AfxMessageBox("请输入IP地址!");
return;
}
if(nField0==0||nField3==0)
{
AfxMessageBox("您输入的不是有效IP地址");
return;
}



                                            
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  MFC ip地址转换