Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Turbo C - <b>swab() swap bytes</b> http://www.X-Hacker.org [<<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);
          }

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson