htobe16, htole16, be16toh, le16toh, htobe32, htole32, be32toh, le32toh,
   htobe64, htole64, be64toh, le64toh - convert values  between  host  and
   big-/little-endian byte order


   #include <endian.h>

   uint16_t htobe16(uint16_t host_16bits);
   uint16_t htole16(uint16_t host_16bits);
   uint16_t be16toh(uint16_t big_endian_16bits);
   uint16_t le16toh(uint16_t little_endian_16bits);

   uint32_t htobe32(uint32_t host_32bits);
   uint32_t htole32(uint32_t host_32bits);
   uint32_t be32toh(uint32_t big_endian_32bits);
   uint32_t le32toh(uint32_t little_endian_32bits);

   uint64_t htobe64(uint64_t host_64bits);
   uint64_t htole64(uint64_t host_64bits);
   uint64_t be64toh(uint64_t big_endian_64bits);
   uint64_t le64toh(uint64_t little_endian_64bits);

   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):

   htobe16(),   htole16(),  be16toh(),  le16toh(),  htobe32(),  htole32(),
   be32toh(), le32toh(), htobe64(), htole64(), be64toh(), le64toh():
       Since glibc 2.19:
       In glibc up to and including 2.19:


   These functions convert the byte encoding of integer  values  from  the
   byte  order that the current CPU (the "host") uses, to and from little-
   endian and big-endian byte order.

   The number, nn, in the name of each  function  indicates  the  size  of
   integer handled by the function, either 16, 32, or 64 bits.

   The  functions  with names of the form "htobenn" convert from host byte
   order to big-endian order.

   The functions with names of the form "htolenn" convert from  host  byte
   order to little-endian order.

   The  functions with names of the form "benntoh" convert from big-endian
   order to host byte order.

   The functions with names of the form  "lenntoh"  convert  from  little-
   endian order to host byte order.


   These functions were added to glibc in version 2.9.


   These  functions are nonstandard.  Similar functions are present on the
   BSDs, where the required  header  file  is  <sys/endian.h>  instead  of
   <endian.h>.  Unfortunately, NetBSD, FreeBSD, and glibc haven't followed
   the original OpenBSD naming convention for these functions, whereby the
   nn  component always appears at the end of the function name (thus, for
   example, in NetBSD, FreeBSD, and  glibc,  the  equivalent  of  OpenBSDs
   "betoh32" is "be32toh").


   These  functions  are  similar  to  the  older  byteorder(3)  family of
   functions.  For example, be32toh() is identical to ntohl().

   The advantage of the byteorder(3) functions is that they  are  standard
   functions  available  on all UNIX systems.  On the other hand, the fact
   that they were designed for use in the context  of  TCP/IP  means  that
   they lack the 64-bit and little-endian variants described in this page.


   The  program  below  display  the results of converting an integer from
   host byte order to both little-endian and big-endian byte order.  Since
   host  byte  order  is  either  little-endian or big-endian, only one of
   these conversions will have an effect.  When we run this program  on  a
   little-endian system such as x86-32, we see the following:

       $ ./a.out
       x.u32 = 0x44332211
       htole32(x.u32) = 0x44332211
       htobe32(x.u32) = 0x11223344

   Program source

   #include <endian.h>
   #include <stdint.h>
   #include <stdio.h>
   #include <stdlib.h>

   main(int argc, char *argv[])
       union {
           uint32_t u32;
           uint8_t arr[4];
       } x;

       x.arr[0] = 0x11;     /* Lowest-address byte */
       x.arr[1] = 0x22;
       x.arr[2] = 0x33;
       x.arr[3] = 0x44;     /* Highest-address byte */

       printf("x.u32 = 0x%x\n", x.u32);
       printf("htole32(x.u32) = 0x%x\n", htole32(x.u32));
       printf("htobe32(x.u32) = 0x%x\n", htobe32(x.u32));



   bswap(3), byteorder(3)


   This  page  is  part of release 4.09 of the Linux man-pages project.  A
   description of the project, information about reporting bugs,  and  the
   latest     version     of     this    page,    can    be    found    at

More Linux Commands

subpad(3ncurses) - create and display curses pads (ManPage)
The newpad routine creates and returns a pointer to a new pad data structure with the given number of lines, nlines, and columns, ncols. A pad is like a window,

glTexImage2D(3gl) - specify a two-dimensional texture image
glTexImage2D.3gl - Texturing maps a portion of a specified texture image onto each graphical primitive for which texturing is enabled. To enable and disable two

spinbox(n) - Create and manipulate spinbox widgets (ManPage)
The spinbox command creates a new window (given by the pathName argument) and makes it into a spinbox widget. Additional options, described above, may be specif

git-instaweb(1) - Instantly browse your working repository i
A simple script to set up gitweb and a web server for browsing the local repository. OPTIONS -l, --local Only bind the web server to the local IP ( -

chfn(1) - change finger information - Linux manual page.....
The chfn command changes user fullname, office room number, office phone number, and home phone number information for a users account. This information is typi

IsKeypadKey(3) - keysym classification macros (Man Page)....
The IsCursorKey macro returns True if the specified KeySym is a cursor key. The IsFunctionKey macro returns True if the KeySym is a function key. The IsKeypadKe

mvdelch(3ncurses) - delete character under the cursor in a c
These routines delete the character under the cursor; all characters to the right of the cursor on the same line are moved to the left one position and the last

swprintf(3) - formatted wide-character output conversion....
The wprintf() family of functions is the wide-character equivalent of the printf(3) family of functions. It performs formatted output of wide characters. The wp

gnutls_x509_crt_list_verify(3) - API function (Man Page)....
This function will try to verify the given certificate list and return its status. If no flags are specified (0), this function will use the basicConstraints (2

clamd(8) - an anti-virus daemon (Admin - Linux man page)....
The daemon listens for incoming connections on Unix and/or TCP socket and scans files or directories on demand. It reads the configuration from /etc/clamd.conf

setterm(3ncurses) - curses interfaces to terminfo database
These low-level routines must be called by programs that have to deal directly with the terminfo database to handle certain terminal capabilities, such as progr

aot-compile-4.6(1) - Compile bytecode to native and generate
aot-compile is a script that searches a directory for Java bytecode (as class files, or in jars) and uses gcj to compile it to native code and generate the data

We can't live, work or learn in freedom unless the software we use is free.