| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Converts a signed long binary integer (4 bytes) into a numeric value.
Bin2L( <cInteger> ) --> nNumber
The function returns a numeric value in the range of -(2ˆ31) to +(2ˆ31) - 1.
Bin2L() is a binary conversion function that converts a four byte binary number (Valtype()=="C") to a numeric value (Valtype()=="N"). The parameter <cInteger> is usually the return value of function L2Bin().
The range for the numeric return value is determined by a signed long integer.
| See also: | Bin2I(), Bin2U(), Bin2W(), FRead(), I2Bin(), L2Bin(), U2Bin(), W2Bin(), Word() |
| Category: | Binary functions , Conversion functions |
| Source: | rtl\binnum.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example demonstrates encoding of binary signed 32 bit integer
// numbers and their conversion to numeric values.
PROCEDURE Main
? Bin2L( Chr(0) + Chr(0) + Chr(0) + Chr(0) ) // result: 0
? Bin2L( Chr(1) + Chr(0) + Chr(0) + Chr(0) ) // result: 1
? Bin2L( Chr(255) + Chr(255) + Chr(255) + Chr(255) ) // result: -1
? Bin2L( Chr(0) + Chr(1) + Chr(0) + Chr(0) ) // result: 256
? Bin2L( Chr(0) + Chr(255) + Chr(255) + Chr(255) ) // result: -256
? Bin2L( Chr(255) + Chr(255) + Chr(255) + Chr(127) ) // result: 2147483647
? Bin2L( Chr(0) + Chr(0) + Chr(0) + Chr(128) ) // result: -2147483648
RETURN
http://www.xHarbour.com