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>i2bin()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 I2BIN()
 Convert a CA-Clipper numeric to a 16-bit binary integer
------------------------------------------------------------------------------
 Syntax

     I2BIN(<nInteger>) --> cBinaryInteger

 Arguments

     <nInteger> is an integer numeric value to convert.  Decimal digits
     are truncated.

 Returns

     I2BIN() returns a two-byte character string containing a 16-bit binary
     integer.

 Description

     I2BIN() is a low-level file function that converts an integer numeric
     value to a character string formatted as a binary integer--least
     significant byte first.  I2BIN() is used with FWRITE() to convert a
     CA-Clipper numeric to a standard binary form.  The inverse of I2BIN() is
     BIN2I().

 Examples

     .  This example opens a database file using low-level file
        functions and writes a new date of the last update to bytes 1-3:

        #include "Fileio.ch"
        //
        nHandle = FOPEN("Sales.dbf", FO_READWRITE)
        //
        // Convert date of last update to int
        nYear = I2BIN(90)
        nMonth = I2BIN(12)
        nDay = I2BIN(15)
        //
        // Point to the date of last update
        FSEEK(nHandle, 1, FS_SET)
        //
        // Write the new update date using only the first byte
        FWRITE(nHandle, nYear, 1)
        FWRITE(nHandle, nMonth, 1)
        FWRITE(nHandle, nDay, 1)
        FCLOSE(nHandle)

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

See Also: BIN2I() BIN2L() BIN2W() CHR() FWRITE() L2BIN()

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