Bin2L Function | |
Convert a string containing a 32-bit signed integer to a long integer.
Namespace:
XSharp.Core
Assembly:
XSharp.Core (in XSharp.Core.dll) Version: 2.19
Syntax FUNCTION Bin2L(
cSignedInt AS STRING
) AS LONG
public static int Bin2L(
string cSignedInt
)
Request Example
View SourceParameters
- cSignedInt
- 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.
Return Value
Type:
LongRemarks
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().
Examples
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)
5? LTrim(Str(Bin2L(cRecords)))
6FClose(ptrHandle)
See Also