C5_I2BIN

 I2BIN()
 Convert a Clipper numeric to a 16-bit binary integer
------------------------------------------------------------------------------
 Syntax

     I2BIN(<nInteger>) --> cBinaryInteger

 Arguments

     <nInteger> is an integer numeric value to be converted.  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
     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()



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.