[<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
BIN2L()

    Converts a character string formatted as a 32-bit signed integer to a
    Clipper numeric value.

Syntax

    BIN2L(<expC>)

Argument

    <expC> is a four-byte string in the form of a 16-bit signed integer
    number.  If more than four characters are specified, the remaining are
    ignored.

Returns

    An integer numeric value.

Usage

    BIN2L() is used in combination with FREAD() or FREADSTR() to convert a
    four-byte character string as a signed integer to a Clipper numeric.
    This is most useful when you are reading foreign file types and want to
    read numeric data formatted in its native form.

Example

    This example opens a database file using low-level file functions and
    reads the number of records (bytes 4-7).  The result is the same as
    with LASTREC():

    handle = FOPEN("Sales.dbf")                      
    num_recs = SPACE(4)                              
    *                                                
    * Point to byte 4 in the file                    
    FSEEK(handle, 4, 0)                              
    *                                                
    * Read number of records                         
    FREAD(handle, @num_recs, 4)                      
    *                                                
    ? LTRIM(STR(BIN2L(num_recs)))     && Result 84   
    FCLOSE(handle)                                   

See Also: BIN2I BIN2W I2BIN L2BIN FOPEN FCLOSE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility. Written by Dave Pearson