Name

swab
- swap adjacent bytes

Library

libc.lib

Synopsis

  #include <unistd.h>
  void swab (const void * restrict src, void * restrict dst, ssize_t len);

Detailed description

The function swab copies len bytes from the location referenced by src to the location referenced by dst, swapping adjacent bytes.

The argument len must be an even number.


Examples

#include <string.h>
#include <stdio.h>
int main()
{
    int i=0x00003366,j=0x0;
    swab((void *)&i,(void *)&j,2);
    if(j==0x6633)
       printf("Ouput val = %#x\n",j);
    return 0;
}

         

Output

Ouput val = 0x6633

         

See also

bzero, memset

Feedback

For additional information or queries on this page send feedback

© 2005-2007 Nokia

Top