1SWAB(3) Linux Programmer's Manual SWAB(3)
2
3
4
6 swab - swap adjacent bytes
7
9 #define _XOPEN_SOURCE
10 #include <unistd.h>
11
12 void swab(const void *from, void *to, ssize_t n);
13
15 The swab() function copies n bytes from the array pointed to by from to
16 the array pointed to by to, exchanging adjacent even and odd bytes.
17 This function is used to exchange data between machines that have dif‐
18 ferent low/high byte ordering.
19
20 This function does nothing when n is negative. When n is positive and
21 odd, it handles n-1 bytes as above, and does something unspecified with
22 the last byte. (In other words, n should be even.)
23
25 The swab() function returns no value.
26
28 SVr4, 4.3BSD, POSIX.1-2001.
29
31 bstring(3), feature_test_macros(7)
32
34 This page is part of release 3.22 of the Linux man-pages project. A
35 description of the project, and information about reporting bugs, can
36 be found at http://www.kernel.org/doc/man-pages/.
37
38
39
40 2001-12-15 SWAB(3)