| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
![]() |
Converts an unsigned long binary integer (4 bytes) into a numeric value.
Bin2U( <cInteger> ) --> nNumber
The function returns a numeric value in the range of 0 to (2ˆ32) - 1.
Bin2U() 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 U2Bin().
The range for the numeric return value is determined by an unsigned long integer.
| See also: | Bin2I(), Bin2L(), Bin2W(), FRead(), I2Bin(), L2Bin(), U2Bin(), W2Bin(), Word() |
| Category: | Binary functions , Conversion functions |
| Source: | rtl\binnum.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example reads the number of records from the file header
// of a DBF file and displays the converted numeric value.
PROCEDURE Main()
LOCAL nHandle
LOCAL cInteger := Space( 4 )
LOCAL cFile := "Customer.dbf"
nHandle := FOpen( cFile )
IF nHandle > 0
FSeek( nHandle, 4 )
FRead( nHandle, @cInteger, 4 )
? "Number of records in file:", Bin2U( cInteger )
FClose( nHandle )
ELSE
? "Cannot open file:", cFile
ENDIF
RETURN
http://www.xHarbour.com