Chapter Contents

Previous

Next
inet_network

inet_network



Interprets an Internet Network Number

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_network(const char *cp);


DESCRIPTION

inet_network interprets a null-terminated character string, pointed to by cp , that represents numbers in the Internet standard dotted decimal notation and returns that string as an Internet network number of up to four components. Each component is assigned to a byte of the result. If there are fewer than four components, high-order bytes have a value of 0 .

The numbers supplied in dotted decimal notation can be decimal, octal, or hexadecimal, as specified in the C language. In other words, a leading 0x or 0X implies hexadecimal notation; a leading 0 implies octal notation. Otherwise, the number is interpreted as decimal.


RETURN VALUE

If inet_network is successful, it returns the network number. Otherwise, it returns a -1 , and sets errno to indicate the type of error. INADDR_NONE is the symbolic name for the -1 value returned by inet_network when the input is valid.


PORTABILITY

inet_network is portable to other environments, including most UNIX systems, that implement BSD sockets.


IMPLEMENTATION

The SAS/C version of inet_network is a direct port from the BSD UNIX Socket Library.


RELATED FUNCTIONS

inet_lnaof , inet_makeaddr , inet_netof , inet_addr , inet_ntoa


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.