Skip to content

Got C4996 problem when using it into my project #23

Description

@wzf-cn

Hi,
The example could be run correctly along in a project. But when I include this code into my project, the error came out.

c4996 'inet_addr':Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings

I had followed the solution in the stackoverflow, included the "Ws2tcpip.h" and changed the line 127 and line 205 in the influxdb.hpp as follows, then the program returned -3.

// For line 127
InetPton(AF_INET, (PCWSTR)(host.c_str()), &addr.sin_addr.s_addr);
if (addr.sin_addr.s_addr == INADDR_NONE) return -1;
// For line 205
InetPton(AF_INET, (PCWSTR)(si.host_.c_str()), &addr.sin_addr.s_addr);
if (addr.sin_addr.s_addr == INADDR_NONE) return -1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions