ntohl() — Translate a long integer into host byte order

Standards

Standards / Extensions C or C++ Dependencies

XPG4.2
Single UNIX Specification, Version 3

both  

Format

XPG4.2:
#define _XOPEN_SOURCE_EXTENDED 1
#include <arpa/inet.h>

in_addr_t ntohl(in_addr_t netlong);
SUSV3:
#define _POSIX_C_SOURCE 200112L
#include <arpa/inet.h>

unit32_t ntohl(uint32_t netlong);
Berkeley sockets:
#define _OE_SOCKETS
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>

unsigned long ntohl(unsigned long a);

General description

The ntohl() function translates a long integer from network byte order to host byte order.
Parameter
Description
a
The unsigned long integer to be put into host byte order.
in_addr_t netlong
Is typed to the unsigned long integer to be put into host byte order.
Notes:
  1. For MVS™, host byte order and network byte order are the same.
  2. Since this function is implemented as a macro, you need one of the feature test macros and the inet header file.

Returned value

ntohl() returns the translated long integer.

Related information