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>bin2w()</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
BIN2W()


Syntax:     BIN2W(<expC>)

Purpose:    To convert a character string formatted as a 16-bit unsigned
            integer to a Clipper numeric value.

Argument:   <expC> is a two-byte character string in the form of a
            16-bit unsigned or long integer number--least significant
            byte first.

Returns:    An integer numeric value.

Usage:      BIN2W() is used in combination with FREAD() to convert a
            two-byte character string formatted as an unsigned integer
            to a Clipper numeric.  This is most useful when you are
            reading foreign file types and you want to read numeric data
            formatted in its native form.

Library:    EXTEND.LIB

Source:     EXAMPLEA.ASM


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

   This example opens a database file using low-level file functions and
   reads the number of bytes per record (bytes 10-11).  The result is
   the same as with RECSIZE().

   handle = FOPEN("Sales.dbf")
   *
   * Point to byte 10, the first record size byte.
   FSEEK(handle, 10, 0)
   *
   * Read record size.
   rec_size = SPACE(2)
   FREAD(handle, @rec_size, 2)
   *
   ? LTRIM(STR(BIN2W(rec_size)))    && Result: 124
   FCLOSE(handle)


See Also: BIN2I() BIN2L() I2BIN() L2BIN() FREAD()

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