Convert a string containing a 32-bit signed integer to a long integer.
XSharp.Core (in XSharp.Core.dll) Version: 2.4a
Syntax View Source
cSignedInt AS STRING
) AS LONG
public static int Bin2L(
- Type: String
A 32-bit signed integer represented as a string — least significant byte first. Only the first 4 bytes are used by the function; all others are ignored.
Bin2L() is a conversion function that converts the first 4 bytes of a string to a long integer. Typical applications include reading foreign file types in their native format then saving, reading, decrypting, and transmitting numeric data in their compressed binary form instead of in strings.
Its inverse is L2Bin().
This example opens a database file using file functions and reads the number of records (bytes 4-7).
The result is the same as LastRec():
1ptrHandle := FOpen2("sales.dbf", FO_READ)
2FSeek(ptrHandle, 4, FS_SET)
3cRecords := Space(4)
4FRead(ptrHandle, @cRecords, 4)