[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
#include <stdlib.h>
void swab( char *src, char *dest, int num );
Description:
The swab function copies num bytes (which should be even) from src to
dest swapping every pair of characters. This is useful for preparing
binary data to be transferred to another machine that has a different
byte ordering.
Returns:
The swab function has no return value.
Example:
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
char *msg = "hTsim seasegi swspaep.d";
#define NBYTES 24
void main()
{
auto char buffer[80];
printf( "%s\n", msg );
memset( buffer, '\0', 80 );
swab( msg, buffer, NBYTES );
printf( "%s\n", buffer );
}
produces the following:
hTsim seasegi swspaep.d
This message is swapped.
Classification:
WATCOM
Systems:
All, Netware
Online resources provided by: http://www.ClipX.Net --- NG 2 HTML conversion by Dave Pearson