一段小代码很容易获得本机IP地址和NAME
- 软件类别: 其它类别
- 软件大小: 1KB
- 运行环境: windows
- 软件等级: ★★★
- 演示:
- 缩略图:
- 下载次数: 660
软件介绍
//获得本地主机名和IP地址
WORD wVersionRequested;
WSADATA wsaData;
char name[255];
CString ip;
PHOSTENT hostinfo;
wVersionRequested = MAKEWORD( 2, 0 );
if ( WSAStartup( wVersionRequested, &wsaData ) == 0 )
{
if( gethostname ( name, sizeof(name)) == 0)
{
if((hostinfo = gethostbyname(name)) != NULL)
{
ip = inet_ntoa (*(struct in_addr *)*hostinfo->h_addr_list);
}
}
WSACleanup( );
}
/*----------------------------------------------------------------
sprintf(cmdstr,"Local_IP:%s !!
Bank_IP:%-15.15s",ip,tmp_IP);
AfxMessageBox(cmdstr);
----------------------------------------------------------------*/
sprintf(loc_IP,"%-15.15s",ip);
通过以上小段代码即可获得本机IP地址和NAME。附件和以上代码一样。
相关软件
相关说明
- 四、源码和软件包含破解版及注册码均是由网上搜集免费提供下载,若本站提供的内容侵犯了您的权益,请发信给我们,本站将立即改正!
