Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>i2bin()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
I2BIN()


Syntax:     I2BIN(<expN>)

Purpose:    To convert an integer numeric value to a character string
            formatted as a binary integer--least significant byte first.

Argument:   <expN> is the numeric values to convert.  Note that
            decimal digits are truncated.

Returns:    A character string.

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

Usage:      I2BIN() is used in combination with FWRITE() to convert a
            Clipper numeric data type to a two-byte character string
            formatted as an integer.

Library:    EXTEND.LIB

Source:     EXAMPLEA.ASM


----------------------------------- Example --------------------------------

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

   handle = FOPEN("Sales.dbf", 2)
   *
   * Convert date of last update to int.
   year  = I2BIN(88)
   month = I2BIN(12)
   day   = I2BIN(15)
   *
   * Point to the date of last update.
   FSEEK(handle, 1, 0)
   *
   * Write the new update date using only the first byte.
   FWRITE(handle, year, 1)
   FWRITE(handle, month, 1)
   FWRITE(handle, day, 1)
   *
   FCLOSE(handle)


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

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