HP 3000 Manuals

swab [ HP C/iX Library Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Library Reference Manual

swab 

Swaps bytes in an array.

Syntax 

     void swab (char *from, char *to, int nbytes);

Parameters 

from          A pointer to the source array.

to            A pointer to the target array.

nbytes        The number of bytes to copy.

Return Values 

None.

Description 

This function copies nbytes bytes pointed to by from to the array pointed
to by to, exchanging adjacent even and odd bytes.  It is useful for
carrying binary data between byte-swapped and non-byte-swapped machines.
The nbytes parameter should be even and non-negative.  If nbytes is odd
and positive, swab() uses nbytes-1 instead.  If nbytes is negative,
swab() does nothing.



MPE/iX 5.0 Documentation