Network Address Conversion Routines
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
/* in_addr structure */
unsigned long inet_addr(char *ptr)
char *inet_ntoa(struct in_addr inaddr)
inet_addr() converts a character string in dotted-decimal notation to a 32-bit Internet address. The return value is not consistent, unfortunately. The correct return should be a pointer to a structure of type in_addr but many systems, following an older convention, return only the internal representation of the dotted-decimal notation. The man pages will clarify the situation for the host system on which the function is used.
inet_ntoa() expects a structure of type in_addr as a parameter (note that the structure itself is passed, not a pointer) and returns a pointer to a character string containing the dotted-decimal representation of the Internet address.
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
/* in_addr structure */
unsigned long inet_addr(char *ptr)
char *inet_ntoa(struct in_addr inaddr)
inet_addr() converts a character string in dotted-decimal notation to a 32-bit Internet address. The return value is not consistent, unfortunately. The correct return should be a pointer to a structure of type in_addr but many systems, following an older convention, return only the internal representation of the dotted-decimal notation. The man pages will clarify the situation for the host system on which the function is used.
inet_ntoa() expects a structure of type in_addr as a parameter (note that the structure itself is passed, not a pointer) and returns a pointer to a character string containing the dotted-decimal representation of the Internet address.