LinuxGuruz
  • Last 5 Forum Topics
    Replies
    Views
    Last post


The Web Only This Site
  • BOOKMARK

  • ADD TO FAVORITES

  • REFERENCES


  • MARC

    Mailing list ARChives
    - Search by -
     Subjects
     Authors
     Bodies





    FOLDOC

    Computing Dictionary




  • Text Link Ads






  • LINUX man pages
  • Linux Man Page Viewer


    The following form allows you to view linux man pages.

    Command:

    htobe32

    
           big-/little-endian byte order
    
    
    

    SYNOPSIS

           #define _BSD_SOURCE             /* See feature_test_macros(7) */
           #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);
    
    
    

    DESCRIPTION

           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.
    
    
    

    VERSIONS

           These functions were added to glibc in version 2.9.
    
    
    

    CONFORMING TO

           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 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>
    
           int
           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));
    
               exit(EXIT_SUCCESS);
           }
    
    
    

    SEE ALSO

           byteorder(3)
    
    
    

    GNU 2010-09-10 ENDIAN(3)

    
    
  • MORE RESOURCE


  • Linux

    The Distributions





    Linux

    The Software





    Linux

    The News



  • MARKETING






  • Toll Free

webmaster@linuxguruz.com
Copyright © 1999 - 2016 by LinuxGuruz