Swab (programming)
From Wikipedia, the free encyclopedia
- The correct title of this article is swab. The initial letter is shown capitalized due to technical restrictions.
swab is a function in C programming language that swaps the contents of two areas of bytes in the memory. As far as traceable, swab
is the contraction of swap byte. When used, it is included from the stdlib.h
header file.
The swab()
function is useful for preparing blocks of data for further processing, in situations where the data blocks have been sent through a network arranged in network byte order, and must be rearranged into native byte order (or vice versa). This deals specifically with data blocks that are composed of 2-byte (16-bit) words that must be rearranged so that they have the proper endianness appropriate for the local system.