Data conversion functions are provided to convert both from the foreign system to the host, and from the host to the foreign system. Before we look at these functions, some definitions:
The system that is running our program.
The system that produced the data we are trying to process. This could be the same system as the host or a different system. This could have the same or different native byte ordering than the host.
Functions are provided that allow you to convert shorts and longs in either direction. These functions are described more completely in the cvt reference page. Briefly however:
Converts a longword (32 bit integer) from foreign to host format.
Converts a short (16 bit word) from foreign to host format.
Converts a longword (32 bit integer) from host to foreign system format.
Converts a short (16 bit integer) from host to foreign system format.