Convert a 32-bit signed integer to a numeric value

     BIN2L(<cSignedInt>) --> nNumber


     <cSignedInt> is a character string in the form of a 32-bit signed
     integer number--least significant byte first.  Only the first four
     characters are used by the function; all others are ignored.


     BIN2L() returns an integer numeric value.


     BIN2L() is a low-level file function that is used with FREAD() to
     convert a four-byte character string formatted as a signed integer to a
     Clipper numeric data type.  This is most useful when you are reading
     foreign file types and want to read numeric data in its native format.


     .  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():

        #include "Fileio.ch"
        nHandle := FOPEN("Sales.dbf", FO_READ)
        // Note:  Sales.dbf contains 84 records
        // Point to byte 4
        FSEEK(nHandle, 4, FS_SET)
        // Read the number of records
        cRecords := SPACE(4)
        FREAD(nHandle, @cRecords, 4)
        ? LTRIM(STR(BIN2L(cRecords)))         // Result: 84

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



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.