Copies a specified number of bytes from a source buffer to a destination buffer, swapping every pair of bytes.
#include <string.h>
void swab (
const void *src,
void *dst,
size_t n);
(IN) Points to the string to be transformed.
(OUT) Points to the array into which to place the transformed characters.
(IN) Specifies the number of bytes to swap.
The swab function copies n bytes (which should be even) from src to dst swapping every pair of bytes. This is useful for preparing binary data to be transferred to another machine that has a different byte ordering.
If the number of bytes is odd, the disposition of the last byte is unspecified.