Endian-swap a given number of bytes
#include <unistd.h> void swab( const void * src, void * dest, ssize_t nbytes );
- A pointer to the buffer that you want to copy the bytes from.
- A pointer to the buffer where you want the function to copy the bytes.
- The number of bytes that you want to copy and swap.
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The swab() function copies nbytes bytes, pointed to by src, to the object pointed to by dest, exchanging adjacent bytes. The nbytes argument should be even.
|If nbytes is:||Then:|
|Odd||nbytes-1 bytes are copied and exchanged. The disposition of the last byte is unspecified.|
|Negative||swab() does nothing.|
If copying takes place between objects that overlap, the behavior is undefined.
Last modified: 2013-12-23