BLOB to integer

4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next

version 6.0


BLOB to integer (blob; byteOrder{; offset}) Number

ParameterTypeDescription
blobBLOBBLOB from which to get the integer value
byteOrderNumber0  Native byte ordering
1  Macintosh byte ordering
2  PC byte ordering
offsetVariableOffset within the BLOB (expressed in bytes)
New offset after reading
Function resultNumber2-byte Integer value

Description

The BLOB to integer command returns a 2-byte Integer value read from the BLOB blob.

The byteOrder parameter fixes the byte ordering of the 2-byte Integer value to be read. You pass one of the following predefined constants provided by 4th Dimension:

ConstantTypeValue
Native byte orderingLong Integer0
Macintosh byte orderingLong Integer1
PC byte orderingLong Integer2

Note regarding Platform Independence: If you exchange BLOBs between Macintosh and PC platforms, it is up to you to manage byte swapping issues when using this command.

If you specify the optional offset variable parameter, the 2-byte Integer value is read at the offset (starting from zero) within the BLOB. If you do not specify the optional offset variable parameter, the first two bytes of the BLOB are read.

Note: You should pass an offset (in bytes) value between 0 (zero) and the size of the BLOB minus 2. If you do not do so, an error -111 is generated.

After the call, the variable is incremented by the number of bytes read, Therefore, you can reuse that same variable with another BLOB reading command to read another value.

Example

The following example reads 20 Integer values from a BLOB, starting at the offset 0x200:

   $vlOffset:=0x200
   For ($viLoop;0;19)
      $viValue:=BLOB to integer(vxSomeBlob;PC byte ordering;$vlOffset)
         ` Do something with $viValue
   End for

See Also

BLOB to longint, BLOB to real, BLOB to text, INTEGER TO BLOB, LONGINT TO BLOB, REAL TO BLOB, TEXT TO BLOB.


4D - Documentation   Français   English   German   4th Dimension 2004, Command Theme List   4th Dimension 2004, Command Alphabetical List   4th Dimension 2004, Constant Theme List   Back   Previous   Next