xHarbour Reference Documentation > Function Reference |
Converts an unsigned short binary integer (2 bytes) into a numeric value.
Bin2W( <cInteger> ) --> nNumber
The function returns a numeric value in the range of 0 to +(2ˆ16) - 1.
Bin2W() is a binary conversion function that converts a two byte binary number (Valtype()=="C") to a numeric value (Valtype()=="N"). The parameter <cInteger> is usually the return value of function W2Bin().
The range for the numeric return value is determined by an unsigned short integer.
See also: | Bin2I(), Bin2L(), Bin2U(), 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 header size from the file header // of a DBF file and displays the converted numeric value. PROCEDURE Main() LOCAL nHandle LOCAL cInteger := Space( 2 ) LOCAL cFile := "Customer.dbf" nHandle := FOpen( cFile ) IF nHandle > 0 FSeek( nHandle, 8 ) FRead( nHandle, @cInteger, 2 ) ? "Size of file header:", Bin2W( cInteger ) FClose( nHandle ) ELSE ? "Cannot open file:", cFile ENDIF RETURN
http://www.xHarbour.com