Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要从 iOS 中的主机名解析 IP 地址。我知道使用 NSHost 很简单,但是 NSHost 解析功能似乎只适用于 OSX。
提前致谢。
像这样:
struct hostent *host_entry = gethostbyname("stackoverflow.com"); char *buff; buff = inet_ntoa(*((struct in_addr *)host_entry->h_addr_list[0]));
buff 变量现在包含一个 IP 地址...