Chapter Contents |
Previous |
Next |
inet_addr |
Portability: | UNIX compatible |
SYNOPSIS | |
DESCRIPTION | |
RETURN VALUE | |
PORTABILITY | |
IMPLEMENTATION | |
RELATED FUNCTIONS |
SYNOPSIS |
#include <sys/types.h> #include <netinet/in.h> #include <arpa/inet.h> unsigned long inet_addr(const char *cp);
DESCRIPTION |
inet_addr
interprets a null-terminated character string, pointed to
by
cp
, that represents
numbers in the Internet standard dotted decimal notation and returns a corresponding
Internet address. The dotted decimal string can contain up to four components.
All but the last components are placed in succeeding bytes, beginning with
the high-order byte. The last component fills all remaining bytes. This
dotted decimal notation takes one of the following forms:
RETURN VALUE |
If
inet_addr
is successful, it returns the address in network byte order.
Otherwise, it returns a
-1UL
(
0xFFFFFFFF
), and
sets
errno
to indicate
the type of error. INADDR_NONE is the symbolic name for the
-1UL
value returned by
inet_addr
when the input is valid.
PORTABILITY |
inet_addr
is portable to other environments, including most UNIX systems,
that implement BSD sockets. On some systems, this routine may return the
type
struct in_addr
.
IMPLEMENTATION |
The SAS/C version of
inet_addr
is a direct port from the BSD UNIX
Socket Library.
RELATED FUNCTIONS |
inet_lnaof
,
inet_makeaddr
,
inet_netof
,
inet_network
,
inet_ntoa
Chapter Contents |
Previous |
Next |
Top of Page |
Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.