Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper 5.2 . The Guide To CA-Clippe - <b>bin2i()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 BIN2I()
 Convert a 16-bit signed integer to a numeric value
------------------------------------------------------------------------------
 Syntax

     BIN2I(<cSignedInt>) --> nNumber

 Arguments

     <cSignedInt> is a character string in the form of a 16-bit signed
     integer number--least significant byte first.  Only the first two
     characters are used by the function; all others are ignored.

 Returns

     BIN2I() returns an integer numeric value.

 Description

     BIN2I() is a low-level file function that is used with FREAD() to
     convert a two-byte character string formatted as a signed integer to a
     CA-Clipper numeric data type.  This is most useful when you are reading
     foreign file types and want to read numeric data in its native format.

 Examples

     .  This example opens a database file using low-level file
        functions and reads the date of last update (bytes 1-3).  The result
        is the same as with LUPDATE():

        #include "Fileio.ch"
        //
        nHandle := FOPEN("Sales.dbf", FO_READ)
        //
        // Point to byte 1 in the file
        FSEEK(nHandle, 1, FS_SET)
        //
        // Read date of last update
        nYear := BIN2I(FREADSTR(nHandle, 1) + CHR(0))
        nMonth := BIN2I(FREADSTR(nHandle, 1) + CHR(0))
        nDay := BIN2I(FREADSTR(nHandle, 1) + CHR(0))
        //
        ? LTRIM(STR(nMonth)), LTRIM(STR(nDay)), LTRIM(STR(nYear))
        FCLOSE(nHandle)

 Files:  Library is EXTEND.LIB, source file is SOURCE\SAMPLE\EXAMPLEA.ASM.

See Also: BIN2L() BIN2W() FREAD() FREADSTR() I2BIN() L2BIN()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson