字符串类型ip同数值类型ip转换


字符串类型ip同数值类型ip转换


====char*-->int===
char chIP[50] = _T("172.0.0.1");
DWORD dwIpAddr =  inet_addr( chIP );

====int-->char*===
CString strIp = "";
DWORD dwIp = 0;
in_addr addr;
addr.S_un.S_addr = dwIp;
strIp = inet_ntoa(addr);

你可能感兴趣的:(字符串类型ip同数值类型ip转换)