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 last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster