Swaps bytes.
Format
#include <unistd.h>
void swab (const void *src, void *dest, ssize_t nbytes);
1 – Arguments
src
A pointer to the location of the string to copy.
dest
A pointer to where you want the results copied.
nbytes
The number of bytes to copy. Make this argument an even value.
When it is an odd value, the swab function uses nbytes -1
instead.
2 – Description
The swab function copies the number of bytes specified by nbytes
from the location pointed to by src to the array pointed to by
dest. The function then exchanges adjacent bytes. If a copy takes
place between objects that overlap, the result is undefined.