isc_vax_integer()

From InterBase

Go Up to API Function Reference


Deprecated. Reverses the byte order of an integer. This function is still supported, but it has been replaced by isc_portable_integer(). isc_vax_integer() only supports up to LONG (4 bytes) values.

Syntax

 ISC_LONG isc_vax_integer(
 char *buffer, 
 short length);
Parameter Type Description

buffer

char *

Pointer to the integer to convert

length

short

Length, in bytes, of the integer to convert

Valid lengths are 1, 2, and 4 bytes.

Description

isc_vax_integer() reverses the byte order of an integer, specified in buffer, and returns the newly ordered value.

A typical use for this function is to convert integer values passed into a database parameter buffer to a format where the least significant byte must be first and the most significant byte last. In InterBase, integer values must be represented in input parameter buffers (for example, the DPB) and are returned in result buffers in a generic format where the least significant byte is first, and the most significant byte last. isc_vax_integer() is used to convert integers to and from this format.

Example

The following code fragment converts a 2-byte value, stored in a character buffer that is the result buffer returned by a function such as isc_database_info():

#include <ibase.h>
char *p;
. . .
for(p = res_buffer; *p != isc_info_end;) {
/* Read item type of next cluster in the result buffer. */
item = *p++;
/* Read length of next value in result buffer, and convert. */
len = isc_vax_integer(p, 2);
p += len;
/* Now process the actual value, len bytes in size. */
. . .
}

Return value

isc_vax_integer() always returns a byte-reversed long integer value.

See Also

Advance To: