Integer Conversion (IS, IL)

Integer Conversion (IS, IL)

Top  Previous  Next

 

The integer conversion codes convert integer values between numeric form and hardware specific integer representation.

 

ISShort integer (16 bit value).
ILLong integer (32 bit value).

 

Used with the ICONV() function, the conversion code translates a QMBasic integer numeric value to the equivalent hardware specific representation of that integer. Used with the OCONV() function, the conversion code translates a hardware specific representation of an integer value to its equivalent QMBasic numeric form.

By default, these conversions adopt the byte ordering of the machine on which the program is being executed. Adding an optional L to the end of the conversion code (ISL, ILL) causes conversion to assume a low byte first format for the hardware representation of the value. Similarly, adding an optional H to the end of the conversion code (ISH, ILH) causes conversion to assume a high byte first format for the hardware representation of the value.

 

These codes should not be used to encode numeric values to be stored in database files as the hardware specific representation may include bytes that will be interpreted as mark characters. These conversions are intended for use in, for example, applications that need to generate hardware specific data for transmission over communications networks.

 

Note that when used in this way, the input and output conversions may appear to be reversed from the expected use. An application would use ICONV() to transform a numeric value to the byte sequence for transmission over the network and OCONV() to transform received data from a byte sequence to a number. These codes were originally defined in another multivalue product and their definition has been maintained.