标签:class blog code tar get 2014
bool CDlgResetAlarmInfo::GetLocalUserNameAddIP(CString &a_lstrUserName ,CString &a_IpStr) { char buf[256]=""; WSADATA w; WSAStartup(0x0101, &w); struct hostent *ph = 0; gethostname(buf, 256); string hostNmae = buf; a_lstrUserName = hostNmae.c_str(); ph = gethostbyname(buf); const char *IP =inet_ntoa(*((struct in_addr *)ph->h_addr_list[0])); string strIp =IP; a_IpStr = strIp.c_str(); WSACleanup(); if (a_lstrUserName == "" || a_IpStr == "") { return false; } return true; }
标签:class blog code tar get 2014
原文地址:http://blog.csdn.net/ghevinn/article/details/31747007