Harbour Reference Guide

 

BIN2L()

Convert signed long encoded bytes into Harbour numeric

Syntax

BIN2L( <cBuffer> ) --> nNumber

Arguments

<cBuffer> is a character string that contain 32 bit encoded signed long integer (least significant byte first). The first four bytes are taken into account, the rest if any are ignored.

Returns

BIN2L() return numeric integer (or 0 if <cBuffer> is not a string).

Description

BIN2L() is one of the low level binary conversion functions, those functions convert between Harbour numeric and a character representation of numeric value. BIN2L() take four bytes of encoded 32 bit signed long integer and convert it into standard Harbour numeric value.

You might ask what is the need for such functions, well, first of all it allow you to read/write information from/to a binary file (like extracting information from DBF header), it is also a useful way to share information from source other than Harbour (C for instance).

BIN2L() is the opposite of L2BIN()
Examples
      // Show number of records in DBF
      FUNCTION main()
      LOCAL nHandle, cBuffer := space( 4 )
      nHandle := fopen( "test.dbf" )
      IF nHandle > 0
         fseek( nHandle, 4 )
         fread( nHandle, @cBuffer, 4 )
         ? "Number of records in file:", BIN2L( cBuffer )
         fclose( nHandle )
      ELSE
         ? "Can not open file"
      ENDIF
      RETURN NIL
Status

Ready

Compliance

BIN2L() works exactly like CA-Clipper's BIN2L()

Files

Library is rtl

See Also

 




[Source Forge]

Other Docs Categories

Advantage Database RDD
Array
Binary conversion
Classes
Code Block
Console input
Conversion
Conversion Tools
DOS
Data input and output
Database
Database Tools
Date
Dos Tools
Environment
Error recovery
Events
File management
GT
Harbour Tools
Internal
Low Level
Math
Misc
Miscellaneous
Nation
Object manipulation
Operating System Specific
Parameter Checks
String Tools
Strings
TBrowse Method
TBrowse class
Terminal
Time
Utility
Variable Management

 

Last updated on 2001/07/30