Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<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

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