Chapter Contents

Previous

Next
htonl

htonl



Converts a Long Integer from Host to Network Order

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
CAUTION
PORTABILITY
IMPLEMENTATION
RELATED FUNCTIONS


SYNOPSIS

#include <sys/types.h>
#include <netinet/in.h>

unsigned long htonl(unsigned long hostlong);


DESCRIPTION

The htonl macro converts an unsigned long integer hostlong from host byte order to network byte order. On an IBM 370, this is a null macro since IBM 370 byte ordering is big endian, as is network byte ordering.


RETURN VALUE

htonl returns the converted value.


CAUTION

There is also an htonl function. Be sure to include the proper header files so that the htonl macro is always used.


PORTABILITY

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


IMPLEMENTATION

The htonl macro is defined in the <netinet/in.h> header file.


RELATED FUNCTIONS

htoncs , htons , ntohcs , ntohs , ntohl


Chapter Contents

Previous

Next

Top of Page

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