inet_ntoa_r()

Updated: April 19, 2023

Convert an Internet address into a string

Synopsis:

#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

char * inet_ntoa_r( struct in_addr in,
                    char * buffer,
                    int bufflen );

Arguments:

in
The Internet address that you want to convert.
buffer
A buffer where the function can store the result.
bufflen
The size of the buffer, in bytes.

Library:

libsocket

Use the -l socket option to qcc to link against this library.

Description:

The inet_ntoa_r() function is a thread-safe version of inet_ntoa(). It converts an IPv4 Internet address into a string (for example, “127.0.0.1”). For more information on this routine, see inet_aton().

Returns:

A string representing an Internet address, or NULL if an error occurred (errno is set).

Errors:

ERANGE
The supplied buffer isn't large enough to store the result.

Classification:

Unix

Safety:  
Cancellation point No
Interrupt handler No
Signal handler No
Thread Yes