[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
swab() Swap Bytes
#include <stdlib.h> Required for declarations only
void swab(source,destination,n);
char *source; Data to be copied and swapped
char *destination; Storage location for swapped data
int n; Number of bytes to copy
swab() copies 'n' bytes from 'source' to 'destination', swapping each
pair of adjacent bytes during the transfer. ('n' should be even to
allow for proper swapping.) 'swab' is primarily used to prepare
binary data for transfer to another machine with a different byte
order.
Returns: No return value.
-------------------------------- Example ---------------------------------
The following statement copies 512 bytes from one location to
another, swapping each pair of adjacent bytes.
#include <stdlib.h>
char srce[512], dest[512];
main()
{
swab(srce,dest,512);
}
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson