C ++ Windows函数调用,获取本地主机名和IP地址 [英] C++ Windows function call that get local hostname and IP address
本文介绍了C ++ Windows函数调用,获取本地主机名和IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有内置的Windows C ++函数调用可以获得主机名和IP地址吗?感谢。
Is there built-in windows C++ function call that can get hostname and IP address? Thanks.
推荐答案
要获取主机名,您可以使用: gethostname 或异步方法 WSAAsyncGetHostByName
To get the hostname you can use: gethostname or the async method WSAAsyncGetHostByName
要获取地址信息,您可以使用: getaddrinfo 或unicode版本 GetAddrInfoW
To get the address info, you can use: getaddrinfo or the unicode version GetAddrInfoW
您可以通过以下方式获取有关计算机名称的更多信息Win32 API: GetComputerNameEx 。
You can get more information about the computer name like the domain by using the Win32 API: GetComputerNameEx.
这篇关于C ++ Windows函数调用,获取本地主机名和IP地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文