gethostname

gethostname returns an ASCII string representation of the first IPv4 address configured on a system.

Syntax

int gethostname(
    char *name,
    int namelen
);

Parameters

name

Pointer to a buffer to store the name.

namelen

The length, in bytes, of the buffer pointed by the name parameter.

Return Value

0 (zero) if the function succeeds, SOCKET_ERROR if the function fails.

Requirements

Minimum Supported Version RTX64 2013
Header Winsock2.h
Library RtTcpip.lib