swab.3c (2010 09)
s
swab(3C) swab(3C)
NAME
swab( ) - swap bytes
SYNOPSIS
#include <unistd.h>
void swab(const void *from, void *to, ssize_t nbytes);
DESCRIPTION
swab() copies nbytes bytes pointed to by from to the array pointed to by to , exchanging adjacent even
and odd bytes. It is useful for carrying binary data between byte-swapped and non-byte-swapped
machines. nbytes should be even and non-negative. If nbytes is odd and positive
swab() uses nbytes −1
instead. If nbytes is negative,
swab() does nothing.
SEE ALSO
thread_safety(5).
STANDARDS CONFORMANCE
swab(): AES, SVID2, SVID3, XPG2, XPG3, XPG4
HP-UX 11i Version 3: September 2010 − 1 − Hewlett-Packard Company 1