SWAB - swap bytes.
(Not in the ANSI standard)
Usage:
void swab();
swab(from,to,N);
Where:
- char *from;
- points to character string whose bytes are to be swapped.
- char *to;
- points to enough memory hold N characters. Characters
will be copied from the "from" string to
"to", switching odd bytes with even (so
"from[0]" is written to "to[1]",
"from[1]" to "to[0]" and so on).
- int N;
- is the number of characters to be copied. This should be
an even non-negative number. If N is negative,
"swab" does nothing. If N is odd,
"swab" copies N-1 bytes.
Description:
"swab" copies one string to another, swapping even
and odd bytes as it goes. Its major purpose is translating data
that will be sent to machines that use a different way to order
the characters in character strings (e.g. PDP-11s).
Copyright © 1996, Thinkage Ltd.