xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

Bin2U()

Converts an unsigned long binary integer (4 bytes) into a numeric value.

Syntax

Bin2U( <cInteger> ) --> nNumber

Arguments

<cInteger>
This is a character string whose first four bytes are converted to a 32 bit unsigned integer value of numeric data type.

Return

The function returns a numeric value in the range of 0 to (2ˆ32) - 1.

Description

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.

Info

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

Example

// 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

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe