VS2013 无法使用'inet_ntoa': Use inet_ntop() or InetNtop() instead or define

解决方法:
1
使用inet_ntop函数替代 或者 在适当位置 定义宏 #define _WINSOCK_DEPRECATED_NO_WARNINGS
2
文件的属性页—–>“预处理器”–>将“_CRT_SECURE_NO_WARNINGS”加上就行
3
文件的属性页—–>c/c++—>常规,将SDL检查改为否

来源:
[http://blog.csdn.net/u010257002/article/details/45393463]

展开阅读全文

inet_ntoa 如何用inet_ntop代替

12-11

inet_ntoa FunctionrnrnThe inet_ntoa function converts an (Ipv4) Internet network address into a string in Internet standard dotted-decimal format.rnrnrnSyntaxrnchar* FAR inet_ntoa(rn __in struct in_addr inrn);rnrnParametersrnin rnAn in_addr structure that represents an Internet host address.rnrnReturn ValuernIf no error occurs, inet_ntoa returns a character pointer to a static buffer containing the text address in standard ".'' notation. Otherwise, it returns NULL.rnrnRemarksrnThe inet_ntoa function takes an Internet address structure specified by the in parameter and returns a NULL-terminated ASCII string that represents the address in "." (dot) notation as in "192.168.16.0", an example of an IPv4 address in dotted-decimal notation. The string returned by inet_ntoa resides in memory that is allocated by Windows Sockets. The application should not make any assumptions about the way in which the memory is allocated. The string returned is guaranteed to be valid only until the next Windows Sockets function call is made within the same thread. Therefore, the data should be copied before another Windows Sockets call is made.rnrnOn Windows Vista and later, the RtlIpv4AddressToString function can be used to convert an IPv4 address represented as an IN_ADDR structure to a string representation of an IPv4 address in Internet standard dotted-decimal notation. On Windows Vista and later, the RtlIpv6AddressToString function can be used to convert an IPv6 address represented as an IN6_ADDR structure to a string representation of an IPv6 address. rnrn 论坛

没有更多推荐了,返回首页