'inet_pton': identifier not found

前端 未结 7 1118
长发绾君心
长发绾君心 2020-12-05 05:04

I\'m trying to include the following code in my program but the error (\'inet_pton\': identifier not found) will appeared.

// IPv4:

struct sockaddr_in ip4a         


        
7条回答
  •  清歌不尽
    2020-12-05 05:29

    the function

    int inet_pton(int af, const char *src, void *dst);
    

    is declared in header file:

    #include 
    

    if this is Windows (Vista or later) there is Winsock analog to this ANSI version:

    INT WSAAPI InetPton(
      _In_   INT  Family,
      _In_   PCTSTR pszAddrString,
      _Out_  PVOID pAddrBuf
    );
    

    try #include add Ws2_32.lib

提交回复
热议问题