gethostname

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

Syntax

Copy
int gethostname(
    [out]   char *name,
    [in]    int namelen
);

Parameters

[out] name

A pointer to a buffer to store the name.

[in] namelen

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

Return Value

If the function succeeds, it returns 0 (zero). If the function fails, it returns SOCKET_ERROR.

Requirements

Minimum supported version Header Library

wRTOS 1.0 SDK

winsock2.h

RttcpipApi.lib