Linux.com

swab.3

SWAB

Section: Linux Programmer's Manual (3)
Updated: 2001-12-15
Index Return to Main Contents
 

NAME

swab - swap adjacent bytes  

SYNOPSIS

#define _XOPEN_SOURCE
#include <unistd.h>

void swab(const void *from, void *to, ssize_t n);
 

DESCRIPTION

The swab() function copies n bytes from the array pointed to by from to the array pointed to by to, exchanging adjacent even and odd bytes. This function is used to exchange data between machines that have different low/high byte ordering.

This function does nothing when n is negative. When n is positive and odd, it handles n-1 bytes as above, and does something unspecified with the last byte. (In other words, n should be even.)  

RETURN VALUE

The swab() function returns no value.  

CONFORMING TO

SVr4, 4.3BSD, POSIX.1-2001.  

SEE ALSO

bstring(3), feature_test_macros(7)  

COLOPHON

This page is part of release 3.21 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/.


 

Index

NAME
SYNOPSIS
DESCRIPTION
RETURN VALUE
CONFORMING TO
SEE ALSO
COLOPHON

 

Comments

Subscribe to Comments Feed

Upcoming Linux Foundation Courses

  1. LFD320 Linux Kernel Internals and Debugging
    15 Sep » 19 Sep - Virtual
    Details
  2. LFS220 Linux System Administration
    22 Sep » 25 Sep - Virtual
    Details
  3. LFS520 OpenStack Cloud Architecture and Deployment
    29 Sep » 02 Oct - Costa Mesa
    Details

View All Upcoming Courses

Become an Individual Member
Check out the Friday Funnies

Sign Up For the Linux.com Newsletter


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board