4D v16.3

BLOB to longint

Home

 
4D v16.3
BLOB to longint

BLOB to longint 


 

BLOB to longint ( blob ; byteOrder {; offset} ) -> Function result 
Parameter Type   Description
blob  BLOB in BLOB from which to get the Long Integer value
byteOrder  Longint in 0 = Native byte ordering, 1 = Macintosh byte ordering, 2 = PC byte ordering
offset  Variable in Offset within the BLOB (expressed in bytes)
in New offset after reading
Function result  Longint in 4-byte Long Integer value

The BLOB to longint command returns a 4-byte Long Integer value read from the BLOB blob.

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

Constant Type Value
Macintosh byte ordering Longint 1
Native byte ordering Longint 0
PC byte ordering Longint 2

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

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

Note: You should pass an offset value between 0 (zero) and the size of the BLOB minus 4. 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 Long Integer values from a BLOB, starting at the offset 0x200:

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



See also 

BLOB to integer
BLOB to real
BLOB to text
INTEGER TO BLOB
LONGINT TO BLOB
REAL TO BLOB
TEXT TO BLOB

 
PROPERTIES 

Product: 4D
Theme: BLOB
Number: 551

This command can be run in preemptive processes

 
HISTORY 

Created: 4D v6

 
TAGS 

Longint, Byteswapping

 
ARTICLE USAGE

4D Language Reference ( 4D v16)
4D Language Reference ( 4D v16.1)
4D Language Reference ( 4D v16.2)
4D Language Reference ( 4D v16.3)